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

            Bug ID: 122196
           Summary: template function that starts with __builtin_ causes
                    an ICE
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Yes I know __builtin_f is in the implementation defined namespace but I don't
think we should crash but rather reject this.

testcase:
```
template<typename T> void __builtin_f(T) {}
void valid_uses() {
  __builtin_f(1);
  __builtin_f('X');
}
```

The ICE:
```
<source>:5:1: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
    5 | }
      | ^
__builtin_f/3 (void __builtin_f(T) [with T = char])
  Type: function definition analyzed
  Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:__builtin_f one_only
  previous sharing asm name: 2
  References: 
  Referring: 
  Function flags: body
  Called by: _Z10valid_usesv/1 
  Calls: 
__builtin_f/2 (void __builtin_f(T) [with T = int])
  Type: function definition analyzed
  Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:__builtin_f one_only
  next sharing asm name: 3
  References: 
  Referring: 
  Function flags: body
  Called by: _Z10valid_usesv/1 
  Calls: 
<source>:5:1: internal compiler error: symtab_node::verify failed

```

Turning off checking we get an assembly failure:
```
/tmp/ccnpHzMa.s: Assembler messages:
/tmp/ccnpHzMa.s:54: Error: symbol `__builtin_f' is already defined
```

Meaning we don't mangle the symbol __builtin_f because it is "builtin".

Reply via email to