This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/14749] [3.3 Regression] Miscompilation of bit test


------- Additional Comments From gdr at integrable-solutions dot net  2004-03-27 00:47 -------
Subject: Re:  New: Miscompilation of bit test

"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


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]