This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: fix argument promotion
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: Re: PATCH: fix argument promotion
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Mon, 4 Jun 2001 13:53:42 -0400 (EDT)
- Cc: jsm28 at cam dot ac dot uk, gcc-patches at gcc dot gnu dot org
> #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)