public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bthomas at brave dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/109110] New: Function Declaration Syntax errors at callsite
Date: Mon, 13 Mar 2023 15:47:07 +0000	[thread overview]
Message-ID: <bug-109110-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-03-13 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 15:47 bthomas at brave dot com [this message]
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

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-109110-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: link
Be 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).