From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AB833857C48; Mon, 21 Nov 2022 14:16:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AB833857C48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669040197; bh=NEC2Gb+kbSSRX6jGb+GDbnG2CJPMK9fhUkMUxUORiNo=; h=From:To:Subject:Date:From; b=kaM3s4+KC8WdUrJdJLs+jOBu26se1ST7+PYwUI08a3qs0bZnjGmcZ5Wchl4UOHr9u itZHCZ9DlXFPet4iVP0cfZnATfIAbmwgB7JQ3Gt/358hqerXT9qNFxUYqbJSNhJcmG YUR6+aGQBUnpanXepavStZpDwH/wSvPbwp2F+pns= From: "coder5506 at pobox dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/107794] New: can't use the string "linux-" via stringizing in the preprocessor Date: Mon, 21 Nov 2022 14:16:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 11.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: coder5506 at pobox dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107794 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 #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=3Dc --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"); }=