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] New: Miscompilation of bit test


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.

-- 
           Summary: Miscompilation of bit test
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: optimization
        AssignedTo: steven at gcc dot gnu dot org
        ReportedBy: steven at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,gdr at integrable-
                    solutions dot net,law at redhat dot com


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]