Note: this is a bug concerning the c99 utility, but since c99 uses
gcc, I report the bug against gcc. Also note that both gcc-4.4 and
gcc-snapshot have the same problem. I've also reported the bug on
GCC's bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40960
In http://www.opengroup.org/onlinepubs/9699919799/utilities/c99.html
POSIX specifies:
-D name[=value]
Define name as if by a C-language #define directive. If no = value
is given, a value of 1 shall be used. The -D option has lower
precedence than the -U option. That is, if name is used in both a
-U and a -D option, name shall be undefined regardless of the
order of the options.
However, gcc doesn't take the precedence rule into account:
$ cat tst.c
int main(void)
{
#ifdef FOO
return 1;
#else
return 0;
#endif
}
$ c99 tst.c -UFOO -DFOO=1
$ ./a.out
zsh: exit 1 ./a.out
whereas FOO should be undefined and the return value should be 0, not 1.
This bug has been reported against an ancient version of gpc (4.1), gcc/g++/gfortran (4.3), or gcj/gij/gobjc (4.4), that was last released with Debian 6.0 (squeeze). But even squeeze-lts has now reached end-of-life and is no longer supported. The bug is assumed to be fixed (or no longer relevant) in newer GCC releases and therefore I'm closing this report now. If the problem is still reproducible in the currently supported versions (gcc-5, gcc-6 or corresponding g++/gcj), feel free to provide more information, reopen and reassign this bug report. Andreas
This bug still occurs with gcc-5.
as this is now the default compiler, and the bug still occurs with it.
Dear submitter, as the package gcc-6 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/920171 The version of this package that was in Debian prior to this removal can still be found using http://snapshot.debian.org/. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Scott Kitterman (the ftpmaster behind the curtain)
as this is now the default compiler, and the bug still occurs with it.
Dear submitter, as the package gcc-8 has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see https://bugs.debian.org/954831 The version of this package that was in Debian prior to this removal can still be found using http://snapshot.debian.org/. Please note that the changes have been done on the master archive and will not propagate to any mirrors until the next dinstall run at the earliest. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org. Debian distribution maintenance software pp. Joerg Jaspert (the ftpmaster behind the curtain)
Still occurs there, which is now the default gcc.
I am Lynn NaffI' from USA. I want us to be good friends. I have some very important things to talk to you. (lynnnaff995@gmail.com) so we can talk more and also send my photos, I wait to hear from you
Reopen bug closed by a spammer.
since the gcc package now depends on gcc-11 and the bug is still present.