Bug 40017 - [4.4/4.5 Regression] stdbool.h/altivec.h
[4.4/4.5 Regression] stdbool.h/altivec.h
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
4.4.0
: P2 normal
: 4.4.1
Assigned To: Not yet assigned to anyone
: rejects-valid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-04 14:26 UTC by Jakub Jelinek
Modified: 2009-05-29 07:16 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2009-05-04 14:26:07 UTC
#include <stdbool.h>
#include <altivec.h>

vector bool int b;

int
main (void)
{
  return 0;
}

used to compile up to 4.3, doesn't any longer.  I wonder what can be done here though, for C++ with the conditional macros bool keywords can coexist well with the context sensitive keywords, but unfortunately #define bool _Bool
kills the conditional keyword behavior.
Comment 1 Jakub Jelinek 2009-05-04 14:30:28 UTC
I'd say handling _Bool the same way as bool after vector would be a good idea.
It has a disadvantage that in addition to the (I'd say desirable):
#include <stdbool.h>
#include <altivec.h>
...
vector bool int i;
also
vector _Bool int i;
would be accepted, but the advantages IMHO outweight disadvantages.
Comment 2 Andrew Pinski 2009-05-04 14:32:52 UTC
Yes that seems like the right idea; the altivec specs was written before C99 was out.
Comment 3 Jakub Jelinek 2009-05-04 14:39:35 UTC
_Bool would need to be a conditional macro too though, I wonder if some ISO C99 pedantry can't test that _Bool isn't defined or something like that.
But then for C++ it is similar with defined(bool) also being true with -maltivec instead of false.
Comment 4 Jakub Jelinek 2009-05-29 07:06:51 UTC
Subject: Bug 40017

Author: jakub
Date: Fri May 29 07:06:35 2009
New Revision: 147970

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147970
Log:
	PR target/40017
	* config/rs6000/rs6000-c.c (_Bool_keyword): New variable.
	(altivec_categorize_keyword, init_vector_keywords,
	rs6000_cpu_cpp_builtins): Define _Bool as conditional macro
	similar to bool.

	* gcc.target/powerpc/altivec-types-1.c: Don't expect error for
	__vector _Bool.
	* gcc.target/powerpc/altivec-30.c: New test.
	* gcc.target/powerpc/altivec-31.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/altivec-30.c
    trunk/gcc/testsuite/gcc.target/powerpc/altivec-31.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000-c.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c

Comment 5 Jakub Jelinek 2009-05-29 07:14:43 UTC
Subject: Bug 40017

Author: jakub
Date: Fri May 29 07:14:20 2009
New Revision: 147971

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147971
Log:
	PR target/40017
	* config/rs6000/rs6000-c.c (_Bool_keyword): New variable.
	(altivec_categorize_keyword, init_vector_keywords,
	rs6000_cpu_cpp_builtins): Define _Bool as conditional macro
	similar to bool.

	* gcc.target/powerpc/altivec-types-1.c: Don't expect error for
	__vector _Bool.
	* gcc.target/powerpc/altivec-30.c: New test.
	* gcc.target/powerpc/altivec-31.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/powerpc/altivec-30.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/powerpc/altivec-31.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/rs6000/rs6000-c.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/powerpc/altivec-types-1.c

Comment 6 Jakub Jelinek 2009-05-29 07:16:48 UTC
Fixed.