public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict
@ 2011-06-09 18:05 edwintorok at gmail dot com
2011-06-09 18:24 ` [Bug c++/49347] " redi at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: edwintorok at gmail dot com @ 2011-06-09 18:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
Summary: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to
__restrict
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: edwintorok@gmail.com
Host: i386-pc-solaris2.10
Target: i386-pc-solaris2.10
Build: i386-pc-solaris2.10
Created attachment 24477
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24477
x.i
G++ 4.6 shows this error, G++ 4.3.3 doesn't:
/usr/include/spawn.h:42:14: error: expected ',' or '...' before 'argv'
/usr/include/spawn.h:50:14: error: expected ',' or '...' before 'argv'
Solaris defines posix_spawn like this:
extern int posix_spawn(
pid_t *_RESTRICT_KYWD pid,
const char *_RESTRICT_KYWD path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *_RESTRICT_KYWD attrp,
char *const argv[_RESTRICT_KYWD],
char *const envp[_RESTRICT_KYWD]);
With GCC 4.6 I see this in preprocessed file:
# 358
"/usr/local/lib/gcc/i386-pc-solaris2.10/4.6.0/include-fixed/sys/feature_tests.h"
3 4
...
#if (defined(__STDC__) && defined(_STDC_C99))
#ifdef __cplusplus
#define _RESTRICT_KYWD __restrict
#else
#define _RESTRICT_KYWD restrict
#endif
#else
#define _RESTRICT_KYWD
#endif
With 4.3.3 I see this:
#if (defined(__STDC__) && defined(_STDC_C99))
#define _RESTRICT_KYWD restrict
#else
#define _RESTRICT_KYWD
#endif
The system header is:
/usr/include/sys/feature_tests.h:
#if (defined(__STDC__) && defined(_STDC_C99))
#define _RESTRICT_KYWD restrict
#else
#define _RESTRICT_KYWD
#endif
Don't know where the #define to __restrict on __cplusplus comes from, but it is
wrong.
GCC 4.6 is:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-pc-solaris2.10/4.6.0/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: /home/chris/apps/compiler/gcc-4.6.0/configure
--enable-languages=c,c++ --disable-libgcj --with-as=/usr/local/bin/as
--with-gnu-as --with-ld=/usr/local/bin/ld --with-gnu-ld --disable-nls
Thread model: posix
gcc version 4.6.0 (GCC)
GCC 4.3.3 is:
Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: ../gcc-4.3.3/configure --prefix=/opt/csw/gcc4
--exec-prefix=/opt/csw/gcc4 --with-gnu-as --with-as=/opt/csw/bin/gas
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-nls --with-included-gettext
--with-libiconv-prefix=/opt/csw --with-x --with-mpfr=/opt/csw
--with-gmp=/opt/csw --enable-java-awt=xlib --enable-libada --enable-libssp
--enable-objc-gc --enable-threads=posix --enable-stage1-languages=c
--enable-languages=ada,c,c++,fortran,java,objc
Thread model: posix
gcc version 4.3.3 (GCC)
To reproduce bug just do this:
$ echo "#include <spawn.h>" >x.cpp
$ g++-4.6 x.cpp
In file included from x.cpp:1:0:
/usr/include/spawn.h:42:14: error: expected ',' or '...' before 'argv'
/usr/include/spawn.h:50:14: error: expected ',' or '...' before 'argv'
Preprocessed x.i attached.
Originally reported for ClamAV:
https://wwws.clamav.net/bugzilla/show_bug.cgi?id=2921
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
@ 2011-06-09 18:24 ` redi at gcc dot gnu.org
2011-06-09 18:29 ` edwintorok at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-09 18:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.06.09 18:24:01
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-09 18:24:01 UTC ---
(In reply to comment #0)
>
> Don't know where the #define to __restrict on __cplusplus comes from, but it is
> wrong.
No, it's correct, see
http://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html
The bug is that G++ can't parse __restrict in an array parameter:
extern int f( char *const envp[__restrict] );
The C front end accepts this, but not the C++ one.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
2011-06-09 18:24 ` [Bug c++/49347] " redi at gcc dot gnu.org
@ 2011-06-09 18:29 ` edwintorok at gmail dot com
2011-06-09 18:35 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: edwintorok at gmail dot com @ 2011-06-09 18:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
--- Comment #2 from Török Edwin <edwintorok at gmail dot com> 2011-06-09 18:29:22 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> >
> > Don't know where the #define to __restrict on __cplusplus comes from, but it is
> > wrong.
>
> No, it's correct, see
> http://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html
>
>
> The bug is that G++ can't parse __restrict in an array parameter:
>
> extern int f( char *const envp[__restrict] );
>
> The C front end accepts this, but not the C++ one.
Is that planned to be fixed for the next release?
If not then as a workaround that fix-includes header could #define
_RESTRICY_KYWD to empty.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
2011-06-09 18:24 ` [Bug c++/49347] " redi at gcc dot gnu.org
2011-06-09 18:29 ` edwintorok at gmail dot com
@ 2011-06-09 18:35 ` redi at gcc dot gnu.org
2011-06-10 18:32 ` [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict jason at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-09 18:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-09 18:35:15 UTC ---
you only reported the bug a few minutes ago, so no, nothing's planned yet!
reduced:
int f( int envp[__restrict] );
p.cc:1:17: error: expected primary-expression before '__restrict'
p.cc:1:17: error: expected ']' before '__restrict'
p.cc:1:17: error: expected ')' before '__restrict'
p.cc:1:27: error: expected initializer before ']' token
The summary should really be adjusted, although this caused a problem on
Solaris the G++ bug isn't Solaris-specific
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
` (2 preceding siblings ...)
2011-06-09 18:35 ` redi at gcc dot gnu.org
@ 2011-06-10 18:32 ` jason at gcc dot gnu.org
2011-07-25 15:21 ` ro at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-10 18:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Summary|G++ does not accept |G++ rejects Solaris spawn.h
|T[__restrict] |use of __restrict
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-10 18:31:28 UTC ---
C++ does not allow type-qualifiers between [], and it seems unnecessary to do
so when the type is going to decay to a pointer anyway. Just have fixincludes
correct the solaris header to
char *const *_RESTRICT_KYWD argv,
char *const *_RESTRICT_KYWD envp);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
` (3 preceding siblings ...)
2011-06-10 18:32 ` [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict jason at gcc dot gnu.org
@ 2011-07-25 15:21 ` ro at gcc dot gnu.org
2011-07-25 15:57 ` ro at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-25 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
URL| |http://gcc.gnu.org/ml/gcc-p
| |atches/2011-07/msg02165.htm
| |l
CC| |ro at gcc dot gnu.org
Target Milestone|--- |4.7.0
--- Comment #5 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-25 15:20:02 UTC ---
Mine, patch posted.
Jason, will there be restrict support in C++ 2011? If so, I might report this
to Oracle, otherwise (with __restrict) it's a pure g++ issue.
Thanks.
Rainer
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
` (4 preceding siblings ...)
2011-07-25 15:21 ` ro at gcc dot gnu.org
@ 2011-07-25 15:57 ` ro at gcc dot gnu.org
2011-07-25 15:59 ` ro at gcc dot gnu.org
2011-07-26 5:09 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-25 15:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
--- Comment #6 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-25 15:56:31 UTC ---
Author: ro
Date: Mon Jul 25 15:56:27 2011
New Revision: 176758
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176758
Log:
PR c++/49347
* inclhack.def (solaris_posix_spawn_restrict): New fix.
* fixincl.x: Regenerate.
* tests/base/spawn.h: New test.
Added:
trunk/fixincludes/tests/base/spawn.h
Modified:
trunk/fixincludes/ChangeLog
trunk/fixincludes/fixincl.x
trunk/fixincludes/inclhack.def
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
` (5 preceding siblings ...)
2011-07-25 15:57 ` ro at gcc dot gnu.org
@ 2011-07-25 15:59 ` ro at gcc dot gnu.org
2011-07-26 5:09 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ro at gcc dot gnu.org @ 2011-07-25 15:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
AssignedTo|unassigned at gcc dot |ro at gcc dot gnu.org
|gnu.org |
--- Comment #7 from Rainer Orth <ro at gcc dot gnu.org> 2011-07-25 15:58:38 UTC ---
Fixed for 4.7.0, to be backported to 4.6 branch.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
` (6 preceding siblings ...)
2011-07-25 15:59 ` ro at gcc dot gnu.org
@ 2011-07-26 5:09 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-26 5:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49347
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-26 05:07:46 UTC ---
(In reply to comment #5)
> Jason, will there be restrict support in C++ 2011?
No.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-07-26 5:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 18:05 [Bug c++/49347] New: G++-4.6 Solaris incorrectly defines _RESTRICT_KYWD to __restrict edwintorok at gmail dot com
2011-06-09 18:24 ` [Bug c++/49347] " redi at gcc dot gnu.org
2011-06-09 18:29 ` edwintorok at gmail dot com
2011-06-09 18:35 ` redi at gcc dot gnu.org
2011-06-10 18:32 ` [Bug c++/49347] G++ rejects Solaris spawn.h use of __restrict jason at gcc dot gnu.org
2011-07-25 15:21 ` ro at gcc dot gnu.org
2011-07-25 15:57 ` ro at gcc dot gnu.org
2011-07-25 15:59 ` ro at gcc dot gnu.org
2011-07-26 5:09 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).