[Bug optimization/14749] New: Miscompilation of bit test
Gabriel Dos Reis
gdr@integrable-solutions.net
Sat Mar 27 00:47:00 GMT 2004
"steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| The following test case is miscompiled by GCC 3.3.3 and earlier
| at -O and higher:
|
| inline void bar (const int id) { if (id & 0x00008000) abort (); }
| int main (void) { bar (0x00000001); return 0; }
|
| Apparently more or less by accident, this problem was fixed on mainline with
| the following patches:
|
| 2003-07-04 Jeff Law <law@redhat.com>
|
| PR c/11428
| * expr.c (do_store_flag): Pass in the correct result type
| when calling fold_single_bit_test.
| * fold-const.c (fold_single_bit_test): Use result_type for the
| result when folding a sign bit test.
|
| 2003-07-02 Jeff Law <law@redhat.com>
|
| * expr.c (do_store_flag): Remove special case folding for
| single bit tests. Instead call back into the commonized folder
| routine.
| * fold-const.c (fold_single_bit_test): New function, mostly
| extracted from do_store_flag, with an additional case extracted
| from fold.
| (fold): Call fold_single_bit_test appropriately.
| * tree.h (fold_single_bit_test): Prototype.
|
| I'd like to backport those for 3.3.4.
It is OK. Thanks for identifying those!.
-- Gaby
More information about the Gcc-bugs
mailing list