From owner-freebsd-questions Fri Sep 24 12:39:20 1999 Delivered-To: freebsd-questions@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id BD45A14CF8 for ; Fri, 24 Sep 1999 12:39:15 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (cs1-gw.cs.binghamton.edu [128.226.171.72]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with SMTP id PAA15506 for ; Fri, 24 Sep 1999 15:39:01 -0400 (EDT) Date: Fri, 24 Sep 1999 15:24:49 -0400 (EDT) From: Zhihui Zhang To: freebsd-questions@freebsd.org Subject: A program that causes "bus error" Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG The following program causes "bus error" on a Sun workstation whether I compile it with cc or gcc: #include main() { union { char a[10]; int i; } u; int * p = (int *) &(u.a[1]); * p = 17; printf("%d\n", *p); } However, it works fine (print out 17) on FreeBSD 3.2. Can anyone explain the difference for me? Thanks a lot. -------------------------------------------------- Zhihui Zhang. Please visit http://www.freebsd.org -------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message