public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/109110] New: Function Declaration Syntax errors at callsite @ 2023-03-13 15:47 bthomas at brave dot com 2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: bthomas at brave dot com @ 2023-03-13 15:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 Bug ID: 109110 Summary: Function Declaration Syntax errors at callsite Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bthomas at brave dot com Target Milestone: --- https://godbolt.org/z/Y8rbd35xP ```C void func1(a) int a[]; { } void func2(int a[]) { } int main(void) { Foo f; func1(f); func1(1.0); func2(f); func2(1.0); return 0; } ``` These two Syntax for declaring a function works fine, however they behave completely different. `func2` gives compilation errors: ``` error: incompatible type for argument 1 of 'func2' expected 'int *' but argument is of type 'Foo' expected 'int *' but argument is of type 'double' ``` However, `func1` compiles and runs just fine. In fact, if I put a printf to print the argument, `func1` will also give no warnings even with `-Werror` unless I explicitly specific `-Wformat`, but `func2` will. in Clang, all of the above gives both errors and warnings and won't compile. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/109110] Function Declaration Syntax errors at callsite 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com @ 2023-03-13 15:50 ` pinskia at gcc dot gnu.org 2023-03-13 15:51 ` pinskia at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-03-13 15:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Because this is a old style function definition and still not a prototype. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/109110] Function Declaration Syntax errors at callsite 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com 2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org @ 2023-03-13 15:51 ` pinskia at gcc dot gnu.org 2023-03-13 15:58 ` [Bug c/109110] old style function declaration not causing incompatible type on calls jakub at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-03-13 15:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- And almost nobody cares about old style function declarations ... ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/109110] old style function declaration not causing incompatible type on calls 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com 2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org 2023-03-13 15:51 ` pinskia at gcc dot gnu.org @ 2023-03-13 15:58 ` jakub at gcc dot gnu.org 2023-03-13 15:59 ` schwab@linux-m68k.org 2023-03-13 16:04 ` mpolacek at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2023-03-13 15:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The GCC behavior is correct, it is as if you moved the func1 definition to a different file, or just used void func1(); in the same file and the definition in another one. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/109110] old style function declaration not causing incompatible type on calls 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com ` (2 preceding siblings ...) 2023-03-13 15:58 ` [Bug c/109110] old style function declaration not causing incompatible type on calls jakub at gcc dot gnu.org @ 2023-03-13 15:59 ` schwab@linux-m68k.org 2023-03-13 16:04 ` mpolacek at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: schwab@linux-m68k.org @ 2023-03-13 15:59 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 --- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> --- 14.8 Certain Changes We Don't Want to Make ========================================== * Checking the number and type of arguments to a function which has an old-fashioned definition and no prototype. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/109110] old style function declaration not causing incompatible type on calls 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com ` (3 preceding siblings ...) 2023-03-13 15:59 ` schwab@linux-m68k.org @ 2023-03-13 16:04 ` mpolacek at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: mpolacek at gcc dot gnu.org @ 2023-03-13 16:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109110 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org Resolution|--- |WONTFIX Status|UNCONFIRMED |RESOLVED --- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Closing out then. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-13 16:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-13 15:47 [Bug c/109110] New: Function Declaration Syntax errors at callsite bthomas at brave dot com 2023-03-13 15:50 ` [Bug c/109110] " pinskia at gcc dot gnu.org 2023-03-13 15:51 ` pinskia at gcc dot gnu.org 2023-03-13 15:58 ` [Bug c/109110] old style function declaration not causing incompatible type on calls jakub at gcc dot gnu.org 2023-03-13 15:59 ` schwab@linux-m68k.org 2023-03-13 16:04 ` mpolacek at gcc dot gnu.org
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).