public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcc at emil dot codes" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105180] New: K&R style definition does not evaluate array size Date: Wed, 06 Apr 2022 14:33:51 +0000 [thread overview] Message-ID: <bug-105180-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105180 Bug ID: 105180 Summary: K&R style definition does not evaluate array size Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gcc at emil dot codes Target Milestone: --- GCC doesn't evaluates the size of an array when declared as a parameter in K&R style declaration. Example program: #include <stdio.h> int crime(s, c) char *s; char c[static printf("%s\n", s)]; { return 0; } int accomplice(s) char *s; { return crime(s, s); } int main(void) { return accomplice("Hello"); } This should print "Hello\n". When using an ANSI definition, it does, but in K&R-style, nothing is printed, `printf` isn't evaluated at all. According to godbolt's compiler explorer, it is a regression which appeared after GCC 4.6.4 and before or in GCC 4.7.1 It works correctly in clang but not in modern GCC.
next reply other threads:[~2022-04-06 14:33 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-06 14:33 gcc at emil dot codes [this message] 2022-04-09 6:33 ` [Bug c/105180] " egallager at gcc dot gnu.org 2022-04-21 15:18 ` [Bug c/105180] [9/10/11/12 Regression] " jsm28 at gcc dot gnu.org 2022-05-27 9:47 ` [Bug c/105180] [10/11/12/13 " rguenth at gcc dot gnu.org 2022-06-28 10:48 ` jakub at gcc dot gnu.org 2022-11-15 6:38 ` pinskia at gcc dot gnu.org 2022-11-15 6:48 ` pinskia at gcc dot gnu.org 2022-11-15 6:52 ` pinskia at gcc dot gnu.org 2023-01-11 16:48 ` jakub at gcc dot gnu.org 2023-01-13 9:36 ` jakub at gcc dot gnu.org 2023-07-07 10:42 ` [Bug c/105180] [11/12/13/14 " rguenth 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-105180-4@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).