public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tg at mirbsd dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111165] [13 regression] builtin strchr miscompiles on Debian/x32 with dietlibc Date: Mon, 28 Aug 2023 16:38:50 +0000 [thread overview] Message-ID: <bug-111165-4-tXJvrBUfsc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-111165-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111165 --- Comment #18 from Thorsten Glaser <tg at mirbsd dot org> --- I cannot, unfortunately. But I have found _another_ “mitigation”: varsub() is static and has only one caller: https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=alioth/mksh.git;a=blob;f=eval.c;h=cb959b1d1104229ead20a698ff2dc974b8da3b10;hb=35563a7897b98de2743233c5f3340a14bea6ebf2#l400 By making varsub… https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=alioth/mksh.git;a=blob;f=eval.c;h=cb959b1d1104229ead20a698ff2dc974b8da3b10;hb=35563a7897b98de2743233c5f3340a14bea6ebf2#l1238 … not static, the bug *also* goes away. (Probably because varsub is not inlined.) Now we see that… 399 sp = cstrchr(sp, '\0') + 1; 400 type = varsub(&x, varname, sp, &stype, &slen); … the varsub call is *directly* below the strchr/strlen line, *and* it gets passed the sp variable. (Inside varsub, the variable is also modified.) My suspicion here is that, somehow only triggerable on x32+dietlibc, something about the multiple modifications of sp (just before and within varsub) confuses GCC? And indeed. Adding -O2, -O1, -O0 to the GCC command line doesn’t help, but -fno-inline again does. As does adding an attribute to the function prototype: static int varsub(Expand *, const char *, const char *, unsigned int *, int *) __attribute__((noinline)); Could we somehow debug there further? I really don’t see a way to reproduce this on x32/glibc or amd64…
next prev parent reply other threads:[~2023-08-28 16:38 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-26 18:17 [Bug target/111165] New: " tg at mirbsd dot org 2023-08-26 18:20 ` [Bug target/111165] " pinskia at gcc dot gnu.org 2023-08-26 18:21 ` pinskia at gcc dot gnu.org 2023-08-26 19:36 ` tg at mirbsd dot org 2023-08-26 20:03 ` tg at mirbsd dot org 2023-08-26 20:21 ` tg at mirbsd dot org 2023-08-26 20:49 ` tg at mirbsd dot org 2023-08-26 21:18 ` tg at mirbsd dot org 2023-08-28 7:25 ` rguenth at gcc dot gnu.org 2023-08-28 14:22 ` tg at mirbsd dot org 2023-08-28 14:41 ` tg at mirbsd dot org 2023-08-28 14:46 ` tg at mirbsd dot org 2023-08-28 14:57 ` tg at mirbsd dot org 2023-08-28 15:02 ` tg at mirbsd dot org 2023-08-28 15:26 ` ubizjak at gmail dot com 2023-08-28 15:44 ` hjl.tools at gmail dot com 2023-08-28 16:08 ` tg at mirbsd dot org 2023-08-28 16:09 ` tg at mirbsd dot org 2023-08-28 16:38 ` tg at mirbsd dot org [this message] 2024-05-21 9:16 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111165-4-tXJvrBUfsc@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).