This is the mail archive of the gcc-patches@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]

Re: PATCH: fix argument promotion


> #include <stdbool.h>
> 
> int f (int a, int b, int c, _Bool d, _Bool e, _Bool f, char g)
> {
>   if (g != 1 || d != true || e != true || f != true) abort ();
>   return a + b + c;
> }
> 
> main ()
> {
>   exit (f (1, 2, -3, true, true, true, '\001'));
> }
> 

The above code exposes the bug in the existing C compiler because cc1
currently promotes boolean types before a call but doesn't demote
them in the callee.  The test passes with cc1plus because it isn't
promoting or demoting booleans at all.  If anybody has a brilliant
idea on how to test for this let me know.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


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