------- Comment #3 from jakub at gcc dot gnu dot org 2010-08-12 11:56 ------- Created an attachment (id=21468) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21468&action=view) gcc46-pr45262.patch
Untested fix. As the testcase shows, while bar isn't miscompiled by 4.1 and earlier, foo is miscompiled even by 3.2. Seems fold_range_test and related routines expect normalized ranges and e.g. PLUS_EXPR/MINUS_EXPR do that normalization, but NEGATE_EXPR handling does not. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45262