This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3.3 -03 produces bad code
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Ronald Kukuck <RKukuck at UUMail dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 17 Apr 2003 16:04:24 -0400
- Subject: Re: gcc 3.3 -03 produces bad code
- References: <3E9F0147.1050606@UUMail.de>
On Thu, Apr 17, 2003 at 09:32:23PM +0200, Ronald Kukuck wrote:
> Hello,
>
> I'm using:
>
> gcc version 3.3 20030226 (prerelease) (SuSE Linux)
>
> A large application (~25MB), which worked fine with the gcc included
> in Suse 8.1, is now crashing in some modules if I compile it with "-O3".
>
> I have tried to make the bug reproducible in a small file (test1.C).
> To see it working OK use:
>
> g++ -O -o test test1.C
>
> to see it fail use:
>
> g++ -O3 -funroll-loops -mcpu=pentiumpro -o test test1.C
>
> or use simply:
>
> g++ -O3 -o test test1.C
>
> which is producing different results then above one.
>
>
> Is there a workaround for this problem or is there a place where I can
> download a new binary?
> inline int ReadDbRecHead(int *pred,int *succ,int *next, short *infopa, const int rec_no, const int dbunit) {
> int *adress, *iptr;
>
> // DbsFindReadAdr(dbunit, rec_no);
> adress = (int*)&s_in;
> iptr=(int*)infopa;
> *pred=*adress++;
> *succ=*adress++;
> *next=*adress++;
> *iptr++=*adress++;
> *iptr=*adress;
> return(*adress);
> }
You can't cast a short * to an int * that way. I recommend searching
for information on type aliasing, or seeing the effect of
-fno-strict-aliasing on your code.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer