[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-20 Thread tdragon at tdragon dot net


--- Comment #6 from tdragon at tdragon dot net  2007-06-20 14:44 ---
Created an attachment (id=13743)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13743action=view)
Better testcase; compile with -O2, use with alias_main.c

Compiling this file with -O2 and linking with the object file from alias_main.c
creates a program that demonstrates the miscompilation. Curiously, compiling
with -O2 and -fno-strict-aliasing produces a correct compilation.


-- 

tdragon at tdragon dot net changed:

   What|Removed |Added

  Attachment #13701|0   |1
is obsolete||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328



[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-20 Thread tdragon at tdragon dot net


--- Comment #7 from tdragon at tdragon dot net  2007-06-20 14:46 ---
Created an attachment (id=13744)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13744action=view)
Better testcase pt.2; use with alias1.c

Compile this file with any or no additional options as desired; linking with
the object file from alias1.c to create a program that demonstrates the
miscompilation, if alias1.c was compiled with -O2.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328



[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-20 Thread tdragon at tdragon dot net


--- Comment #8 from tdragon at tdragon dot net  2007-06-20 14:52 ---
Not seeing any further action or confirmation on this yet, I've gone ahead and
created a simpler testcase. It's plain that, when using -O2, line 14 of
alias1.c is skipped.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328



[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-13 Thread tdragon at tdragon dot net


--- Comment #3 from tdragon at tdragon dot net  2007-06-13 22:27 ---
(In reply to comment #2)
 Do you mean the last two stores to b:
  b-time = time;
  b-progress = found ? 4 : 2;
Yes, those two lines are the ones that are wrongly skipped.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328



[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-13 Thread tdragon at tdragon dot net


--- Comment #4 from tdragon at tdragon dot net  2007-06-13 22:36 ---
(In reply to comment #2)
 Though we could have an alias violation if you don't cast back in hashitem to
 the correct type of the argument.
hashitem() uses the type as punned to HASHDATA* (where HASHDATA is a struct
with a single member of type char*). However, by implementation hashitem() will
never assign a new address that doesn't point to the same type as what was
passed -- in this case, it will only ever assign another BINDING*.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328



[Bug tree-optimization/32328] 4.2.0: -O2 causes skipped code

2007-06-13 Thread tdragon at tdragon dot net


--- Comment #5 from tdragon at tdragon dot net  2007-06-13 22:47 ---
Is it possible that an optimization enabled by -O2 *assumes* that hashitem()
will conform with strict aliasing by not dereferencing that argument, and thus
optimizes those lines away? (Not the case.) If this is what is happening and is
the correct behavior, then this is in fact user error and I'm sorry to have
wasted your time.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328