Closed
Description
It seems that the
In https://godbolt.org/z/qM1Eqjhrh, we see
define dso_local void @_Z17my_generator_funcv(ptr nocapture writeonly sret(%struct.int_generator) align 8 %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 !dbg !115 {
[...]
define internal fastcc void @_Z17my_generator_funcv.resume(ptr noalias nonnull align 8 dereferenceable(24) %0) #5 personality ptr @__gxx_personality_v0 !dbg !167 {
[...]
define internal fastcc void @_Z17my_generator_funcv.destroy(ptr noalias nonnull align 8 dereferenceable(24) %0) #5 personality ptr @__gxx_personality_v0 !dbg !198 {
and the corresponding debug info
!115 = distinct !DISubprogram(name: "my_generator_func", linkageName: "_Z17my_generator_funcv", scope: !6, file: !6, line: 28, type: !116, scopeLine: 28, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !118)
!167 = distinct !DISubprogram(name: "my_generator_func", linkageName: "_Z17my_generator_funcv", scope: !6, file: !6, line: 28, type: !116, scopeLine: 28, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !168)
!198 = distinct !DISubprogram(name: "my_generator_func", linkageName: "_Z17my_generator_funcv", scope: !6, file: !6, line: 28, type: !116, scopeLine: 28, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !199)
Note how all 3 functions are assigned the same name and linkage name. Afaik, assigning the same linkageName
is invalid.
Assigning the same name
is valid, but surprising. We should probably distinguish the functions by assigning different names.
Furthermore, all 3 routines are defined to have type !116
, which is defined as
!116 = !DISubroutineType(types: !117)
!117 = !{!7}
!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "int_generator", file: !6, line: 5, size: 64, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !8, identifier: "_ZTS13int_generator")
which indicates that all 3 functions (also the resume and destroy functions) take no parameters and return an int_generator
. However, this is only correct for the ramp function.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done