This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimization/8758: gcc 3.2.1 gives bad values to a long longvariable when optimizing with O2


The following reply was made to PR optimization/8758; it has been noted by GNATS.

From: Andreas Jaeger <aj@suse.de>
To: bhelmste@ai.univ-paris8.fr
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: optimization/8758: gcc 3.2.1 gives bad values to a long long
 variable when optimizing with O2
Date: Fri, 29 Nov 2002 18:21:53 +0100

 GCC 3.3 reports on your code:
 gromit:/tmp:[29]$ /opt/gcc/3.3-devel/bin/gcc -O2 -Wall ~/bug.c 
 /home/aj/bug.c: In function `main':
 /home/aj/bug.c:16: warning: dereferencing type-punned pointer will break strict-aliasing rules
 /home/aj/bug.c:17: warning: dereferencing type-punned pointer will break strict-aliasing rules
 /home/aj/bug.c:18: warning: dereferencing type-punned pointer will break strict-aliasing rules
 /home/aj/bug.c:19: warning: dereferencing type-punned pointer will break strict-aliasing rules
 /home/aj/bug.c:21: warning: integer constant is too large for "long" type
 /home/aj/bug.c:23: warning: integer constant is too large for "long" type
 gromit:/tmp:[0]$ ./a.out 
 hashval should be 0, 
 but hashval = 1122334455667788
 and hashval = 11223344080495ac
 gromit:/tmp:[0]$ /opt/gcc/3.3-devel/bin/gcc -O2 -Wall ~/bug.c -fno-strict-aliasing
 /home/aj/bug.c: In function `main':
 /home/aj/bug.c:21: warning: integer constant is too large for "long" type
 /home/aj/bug.c:23: warning: integer constant is too large for "long" type
 gromit:/tmp:[0]$ ./a.out 
 
 Your code is violating the strict aliasing rules (note the warnings
 are correct here!) and therefore broken.  Please fix your code or
 compile with -fno-strict-aliasing,
 
 Andreas
 -- 
  Andreas Jaeger
   SuSE Labs aj@suse.de
    private aj@arthur.inka.de
     http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]