The GCC manual has a whole section on signedness of bitfields with the ultimate conclusion that the property really isn't an ABI issue, but instead a C dialect issue (agreed). Furthermore it concludes that all targets should behave the same by default.

So it was a mistake for the mcore port to force bitfields to be unsigned and that never should have been included. This patch rectifies that problem.

I should have remembered this -- I went down this path once in the 90s. I don't recall which port anymore, but once Joseph mentioned this policy bits and pieces did start to come back to me.

Restoring the proper default happens to also fix 170 tests in the GCC testsuite, some of which would go into infinite loops when bitfields were treated as signed values (pr88621 for example). Essentially the testing time cuts in half, which was actually the point of digging into pr88621 to begin with.

Pushed to the trunk.

Jeff
commit 6c22779dfb09f9691c2893c5cabfe35187e1b9f6
Author: Jeff Law <j...@ventanamicro.com>
Date:   Tue Dec 19 21:05:25 2023 -0700

    [committed] Stop forcing unsigned bitfields on mcore
    
    The GCC manual has a whole section on signedness of bitfields with the 
ultimate
    conclusion that the property really isn't an ABI issue, but instead a C 
dialect
    issue (agreed).  Furthermore it concludes that all targets should behave the
    same by default.
    
    So it was a mistake for the mcore port to force bitfields to be unsigned and
    that never should have been included.  This patch rectifies that problem.
    
    I should have remembered this -- I went down this path once in the 90s.  I
    don't recall which port anymore, but once Joseph mentioned this policy bits 
and
    pieces did start to come back to me.
    
    Restoring the proper default happens to also fix 170 tests in the GCC
    testsuite, some of which would go into infinite loops when bitfields were
    treated as signed values (pr88621 for example).  Essentially the testing 
time
    cuts in half, which was actually the point of digging into pr88621 to begin
    with.
    
    gcc/
            * config/mcore/mcore.h (CC1_SPEC): Do not set -funsigned-bitfields.

diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 3de4f0b336a..c732dc014c6 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -81,9 +81,6 @@
 
 extern char * mcore_current_function_name;
  
-/* The MCore ABI says that bitfields are unsigned by default.  */
-#define CC1_SPEC "-funsigned-bitfields"
-
 /* Target machine storage Layout.  */
 
 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)      \

Reply via email to