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

--- Comment #41 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-11-14 
09:06:41 UTC ---
Created attachment 22389
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22389
preprocessed ext/super.c

Hi,
this testcase shows that we are no longer able to optimize away ext3_sops
in
 sb->s_magic = (__builtin_constant_p((__u16)((es->s_magic))) ? ({ __u16 __x =
(((es->s_magic))); ((__u16)( (((__u16)(__x) & (__u16)0x00ffU) << 8) |
(((__u16)(__x) & (__u16)0xff00U) >> 8) )); }) : __fswab16(((es->s_magic))));
 if (sb->s_magic != 0xEF53) {
  if (!silent)
   printk("<3>"
          "VFS: Can't find ext3 filesystem on dev %s.\n",
          bdevname(dev));
  goto failed_mount;
 }

The problem is that varpool code now expect that variable accesses are
optimized out at the end of gimple queue instead of using
TREE_SYMBOL_REFERENCED bit.  In this case sb->s_magic shomehow manages to get
undefined and in GIMPLE land we keep the conditional around, while in RTL land
init-regs initialize it to 0 that consequently makes mount to always fail.

I guess it is not real code quality bug since it happens only on undefined
behaviour code, but we might consider doing initialization by zero sometime in
gimple queue, too.

Also I am not quite sure if we are not misoptimizing the code, it is
convoluted.

Reply via email to