From markm@rodent.iafrica.com  Thu Sep 11 03:23:47 1997
Received: from rodent.iafrica.com (markm@rodent.iafrica.com [196.31.1.10])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id DAA12297
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Sep 1997 03:23:44 -0700 (PDT)
Received: (from markm@localhost)
	by rodent.iafrica.com (8.8.7/8.8.5) id MAA27219;
	Thu, 11 Sep 1997 12:23:40 +0200 (SAT)
Message-Id: <199709111023.MAA27219@rodent.iafrica.com>
Date: Thu, 11 Sep 1997 12:23:40 +0200 (SAT)
From: Mark R V Murray <markm@iafrica.com>
Reply-To: markm@iafrica.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: GCC optimization broken with -m486?
X-Send-Pr-Version: 3.2

>Number:         4511
>Category:       gnu
>Synopsis:       GCC optimization broken with -m486?
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 11 03:30:01 PDT 1997
>Closed-Date:    Sun Oct 19 18:42:25 MEST 1997
>Last-Modified:  Sun Oct 19 18:44:39 MEST 1997
>Originator:     Mark R V Murray
>Release:        FreeBSD 2.2-STABLE i386
>Organization:
UUNET Internet Africa
>Environment:

Recent 2.2-STABLE with CFLAGS=	-O2 -m486 -pipe in /etc/make.conf

>Description:

We noticed this problem when sh(1) started to misbehave.
sh objects to a line in a script that looks like

foo=$((2 << 29))

>How-To-Repeat:

[make 2.2-STABLE with CFLAGS in /etc/make.conf as above]

cd /dev ; ./MAKEDEV

>Fix:
	
Workarounds:
1) remove 1 of -O2 or -m486
2) modify the offending line in the script to read
foo=$((2<<29))
   (ie remove the spaces on either side of <<)

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.ORG, markm@iafrica.com
Cc:  Subject: Re: gnu/4511: GCC optimization broken with -m486?
Date: Thu, 11 Sep 1997 21:44:30 +1000

 >We noticed this problem when sh(1) started to misbehave.
 >sh objects to a line in a script that looks like
 >
 >foo=$((2 << 29))
 >
 >>How-To-Repeat:
 >
 >[make 2.2-STABLE with CFLAGS in /etc/make.conf as above]
 >
 >cd /dev ; ./MAKEDEV
 
 I can't duplicate this.
 
 I guess the bug is actually in sh, and different flags just
 move it.
 
 >Workarounds:
 >1) remove 1 of -O2 or -m486
 
 These flags should never have been recommended.  Use -O2 only
 if you want to get nonstandard bugs.  -m486 is worse than useless
 except possibly on 486's.
 
 >2) modify the offending line in the script to read
 >foo=$((2<<29))
 >   (ie remove the spaces on either side of <<)
 
 Actually 1<<29.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Oct 19 18:42:25 MEST 1997 
State-Changed-Why:  

-m486 itself ain't broken.  It's so simple that its effect can easily 
be verified in the compiler sources (it uses a default padding of 4 
bytes instead of 2, and replaces the `leave' with a mov and a pop 
instruction -- that's all folks). 

The bug itself (unles already fixed) is more likely in the shell, but 
we need a method to reproduce it should it appear again. 
>Unformatted:
