[PATCH] Remove bogus optimization from may_alias_p
Richard Guenther
richard.guenther@gmail.com
Tue Oct 21 15:44:00 GMT 2008
On Tue, Oct 21, 2008 at 4:47 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Bootstrapped and tested on x86_64-unknown-linux-gnu for the trunk
>> and the gcc-4_3-branch. Committed to trunk and the branch.
>>
>> Richard.
>>
>> 2008-10-19 Richard Guenther <rguenther@suse.de>
>>
>> * tree-ssa-alias.c (may_alias_p): Remove bogus shortcut.
>
> On the 4.3 branch this causes lots of warnings during bootstrap of the form:
>
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c: In
> function 'pp_base_format':
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:433: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:433 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:435: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:435 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:435: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long long int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:435 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:441: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:441 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:444: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:444 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:444: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:444 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:453: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'void *' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:453 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:458: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:458 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:461: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:461 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:461: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:461 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:467: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:467 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:470: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:470 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:470: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long long unsigned int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:470 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:476: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'location_t *' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:476 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
>
>
> More annoyingly, this doesn't always reproduce manually:
>
> eric@atlantis:~/build/gcc-4_3-branch/native32/gcc> rm pretty-print.o
> eric@atlantis:~/build/gcc-4_3-branch/native32/gcc> /home/eric/build/gcc-4_3-branch/native32/./prev-gcc/xgcc -B/home/eric/build/gcc-4_3-branch/native32/./prev-gcc/ -B/home/eric/install/gcc-4_3-branch/i586-suse-linux/bin/ -c -g -O2 -fomit-frame-pointer -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/home/eric/svn/gcc-4_3-branch/gcc -I/home/eric/svn/gcc-4_3-branch/gcc/. -I/home/eric/svn/gcc-4_3-branch/gcc/../include -I/home/eric/svn/gcc-4_3-branch/gcc/../libcpp/include -I/home/eric/svn/gcc-4_3-branch/gcc/../libdecnumber -I/home/eric/svn/gcc-4_3-branch/gcc/../libdecnumber/bid -I../libdecnumber /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c -o
> pretty-print.o
> eric@atlantis:~/build/gcc-4_3-branch/native32/gcc> rm pretty-print.o ; make
> quickstrap
> /home/eric/build/gcc-4_3-branch/native32/./prev-gcc/xgcc -B/home/eric/build/gcc-4_3-branch/native32/./prev-gcc/ -B/home/eric/install/gcc-4_3-branch/i586-suse-linux/bin/ -c -g -O2 -fomit-frame-pointer -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/home/eric/svn/gcc-4_3-branch/gcc -I/home/eric/svn/gcc-4_3-branch/gcc/. -I/home/eric/svn/gcc-4_3-branch/gcc/../include -I/home/eric/svn/gcc-4_3-branch/gcc/../libcpp/include -I/home/eric/svn/gcc-4_3-branch/gcc/../libdecnumber -I/home/eric/svn/gcc-4_3-branch/gcc/../libdecnumber/bid -I../libdecnumber /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c -o
> pretty-print.o
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c: In
> function 'pp_base_format':
> /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:433: warning: likely
> type-punning may break strict-aliasing rules: object '*{unknown}' of main
> type 'long int' is referenced at or
> around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:433 and may be
> aliased to object '_sch_istable' of main type 'short unsigned int' which is
> referenced at or around /home/eric/svn/gcc-4_3-branch/gcc/pretty-print.c:284.
> [...]
>
>
> Any idea as to where this can come from?
Hm, I on purpose did testing on the 4.3 branch with checking enabled
to catch such
stuff -- but appearantly enablin checking doesn't enable Werror there ...
The stuff comes from the tree-ssa-alias-warnings.c code which is - err
- bogus. On
the trunk most of it is disabled because we prune all interesting
stuff away from it,
on the branch TBAA pruning of points-to sets was disabled, so the
(bogus) warning
code became "more effective" there. Retaining even more valid
points-to information
makes it appearantly go even more mad ... :/
Unfortunately the author of said infrastructure left GCC development
as I was told in
the past. I will try to have a quick look (or end up reverting the
patch on the branch).
Thanks,
Richard.
More information about the Gcc-patches
mailing list