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

            Bug ID: 127464
           Summary: internal compiler error: in
                    handle_callback_only_attribute
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 0599jiangyc at gmail dot com
  Target Milestone: ---

The following code:

```c
[[gnu::callback_only(1, 2, 3), gnu::callback_only(4, 5)]]
    __builtin_abort ();
```

Resulted in this output:
```
/tmp/test.c:22:8: error: missing binary operator before token '('
   22 | #if !x (__ARM_FEATURE_PAC_DEFAULT)
      |        ^
/tmp/test.c:26:7: error: missing binary operator before token '('
   26 | #if x (__ARM_FEATURE_BTI_DEFAULT)
      |       ^
/tmp/test.c:30:1: error: two or more data types in declaration specifiers
   30 | int
      | ^~~
/tmp/test.c:32:1: internal compiler error: in handle_callback_only_attribute,
at c-family/c-attribs.cc:4737
   32 | {
      | ^
0x2cb9bab internal_error(char const*, ...)
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/diagnostic-global-context.cc:787
0xcdc9e4 fancy_abort(char const*, int, char const*)
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/diagnostics/context.cc:1813
0x7bebb0 handle_callback_only_attribute
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c-family/c-attribs.cc:4737
0xceb446 decl_attributes(tree_node**, tree_node*, int, tree_node*)
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/attribs.cc:905
0xcf8f85 c_decl_attributes
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-decl.cc:5747
0xd0efbd start_function(c_declspecs*, c_declarator*, tree_node*)
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-decl.cc:10799
0xd94250 c_parser_declaration_or_fndef
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-parser.cc:3238
0xda2139 c_parser_external_declaration
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-parser.cc:2256
0xda3080 c_parser_translation_unit
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-parser.cc:2095
0xda3080 c_parse_file()
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c/c-parser.cc:31491
0xe28b99 c_common_parse_file()
       
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-src/gcc/c-family/c-opts.cc:1437
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu -D_REENTRANT /tmp/test.c -quiet -dumpdir a-
-dumpbase test.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O1 -std=c99
-fsyntax-only -fstack-protector-all -fopenmp -o /dev/null
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

```

To reproduce:
```
/home/fuzz/WorkSpace/fusion-fuzz/projects/gcc/gcc-install/bin/gcc -std=c99
./test.c
```

Compiler version:
```
gcc (GCC) 17.0.0 20260917 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Commit:
```
d373724d1ddeef9b322b6b6078fc1de8dbe27791
```

Build configuration:
```
./configure --enable-languages=c,c++ --disable-bootstrap
--enable-checking=yes,extra,rtl --disable-multilib --disable-libsanitizer
--disable-nls --disable-werror
```

Operating System:
```
Ubuntu 22.04 Host, Docker fusion-fuzz-gcc:latest
```

Note: this could be low-priority crash-on-invalid bug

*This bug was found by
[fusion-fuzz](https://github.com/fusion-fuzz/fusion-fuzz)*

Reply via email to