Mixed optimization and pragma settings cause ‘__open_too_many_args’ compile error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.8 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Sample program below compiles with gcc with no errors, but results with a compile error with g++
g++ version: 4.8.2-19ubuntu1
gcc -O2 prog.c # ok
g++ -O2 prog.c # error
In file included from /usr/include/
In function ‘int open(const char*, int, ...)’,
inlined from ‘int main()’ at prog.c:12:40:
/usr/include/
__
Sample program:
#pragma GCC optimize ("O0")
#include <fcntl.h>
#include <unistd.h>
int main()
{
int fd;
fd = open( "filename", O_RDONLY, 0644);
if (fd < 0) return 1;
close(fd);
return 0;
}