https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122427

            Bug ID: 122427
           Summary: nocf_check required on function definition for C
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

This is adapted from the nocf_check documentation.

```
int foo (void) __attribute__((nocf_check));

int
foo (void)
{
  return 0;
}
```

This testcase is rejected by the C FE but accepted by the C++ FE. It works for
other attributes.

```
$ gcc p.c -fcf-protection
p.c:4:1: error: conflicting types for ‘foo’; have ‘int(void)’
    4 | foo (void)
      | ^~~
p.c:1:5: note: previous declaration of ‘foo’ with type ‘int(void)’
    1 | int foo (void) __attribute__((nocf_check));
      |     ^~~
```

Reply via email to