[Bug preprocessor/107794] New: can't use the string "linux-" via stringizing in the preprocessor
coder5506 at pobox dot com
gcc-bugzilla@gcc.gnu.org
Mon Nov 21 14:16:37 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107794
Bug ID: 107794
Summary: can't use the string "linux-" via stringizing in the
preprocessor
Product: gcc
Version: 11.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: coder5506 at pobox dot com
Target Milestone: ---
The program (scratch.c):
#include <stdio.h>
#define str(s) #s
#define xstr(s) str(s)
#define STRING linux-aarch64.cf
int main() {
printf("%s\n", xstr(STRING));
}
The output (running ./a.out):
1-aarch64.cf
Expected output:
linux-aarch64.cf
It works as expected for any string not exactly matching "linux-", but in
everything I've tried "linux-" is always shortened to "l-" even when not at the
beginning of the string.
> the exact version of GCC;
> the system type;
gcc 10.2.1 on Debian 11 x86_64
gcc 10.2.1 on Armbian (Debian 11) aarch64
gcc 11.3.0 on Arbmian (Debian 11) aarch64
> the options given when GCC was configured/built;
In building 11.3.0, I passed "--enable-languages=c --disable-multilib"
> the complete command line that triggers the bug;
gcc -Wall -Wextra -save-temps scratch.c
> the compiler output (error messages, warnings, etc.); and
none
> the preprocessed file (*.i*) that triggers the bug, generated by adding -save-temps to the complete compilation command
Truncated, but here's how it ends
# 858 "/usr/include/stdio.h" 3 4
extern int __uflow (FILE *);
extern int __overflow (FILE *, int);
# 873 "/usr/include/stdio.h" 3 4
# 2 "scratch.c" 2
# 5 "scratch.c"
int main() {
printf("%s\n", "1-aarch64.cf");
}
More information about the Gcc-bugs
mailing list