https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119215
Bug ID: 119215
Summary: -Wodr and -Wlto-type-mismatch issues in cobol
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: build
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
With bootstrap-lto and -Werror=odr -Werror=lto-type-mismatch:
```
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:62:10:
error: type ‘struct copybook_loc_t’ violates the C++ One Definition Rule
[-Werror=odr]
62 | struct copybook_loc_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:62:10:
note: a different type is defined in another translation unit
62 | struct copybook_loc_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:63:13:
note: the first difference of corresponding definitions is field ‘loc’
63 | YYLTYPE loc;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:63:13:
note: a field of same name but different type is defined in another translation
unit
63 | YYLTYPE loc;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:62:10:
note: type name ‘YDFLTYPE’ should match type name ‘YYLTYPE’
62 | struct copybook_loc_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:60:7:
error: type ‘struct copybook_elem_t’ violates the C++ One Definition Rule
[-Werror=odr]
60 | class copybook_elem_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:60:7:
note: a different type is defined in another translation unit
60 | class copybook_elem_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:66:5:
note: the first difference of corresponding definitions is field ‘source’
66 | } source, library;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:66:5:
note: a field of same name but different type is defined in another translation
unit
66 | } source, library;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:62:10:
note: type ‘struct copybook_loc_t’ itself violates the C++ One Definition Rule
62 | struct copybook_loc_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:131:7:
error: type ‘struct copybook_t’ violates the C++ One Definition Rule
[-Werror=odr]
131 | class copybook_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:131:7:
note: a different type is defined in another translation unit
131 | class copybook_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:133:19:
note: the first difference of corresponding definitions is field ‘book’
133 | copybook_elem_t book;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:133:19:
note: a field of same name but different type is defined in another translation
unit
133 | copybook_elem_t book;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/copybook.h:60:7:
note: type ‘struct copybook_elem_t’ itself violates the C++ One Definition Rule
60 | class copybook_elem_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1449:8:
error: type ‘struct cbl_file_t’ violates the C++ One Definition Rule
[-Werror=odr]
1449 | struct cbl_file_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1449:8:
note: a different type is defined in another translation unit
1449 | struct cbl_file_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1473:8:
note: the first difference of corresponding definitions is field
‘var_decl_node’
1473 | tree var_decl_node; // GENERIC tag for the run-time FIELD
structure
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1473:8:
note: a field of same name but different type is defined in another translation
unit
1473 | tree var_decl_node; // GENERIC tag for the run-time FIELD
structure
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1253:8:
error: type ‘struct cbl_alphabet_t’ violates the C++ One Definition Rule
[-Werror=odr]
1253 | struct cbl_alphabet_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1253:8:
note: a different type is defined in another translation unit
1253 | struct cbl_alphabet_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1254:11:
note: the first difference of corresponding definitions is field ‘loc’
1254 | YYLTYPE loc;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1254:11:
note: a field of same name but different type is defined in another translation
unit
1254 | YYLTYPE loc;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1253:8:
note: type name ‘YDFLTYPE’ should match type name ‘YYLTYPE’
1253 | struct cbl_alphabet_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:387:8:
error: type ‘struct cbl_field_t’ violates the C++ One Definition Rule
[-Werror=odr]
387 | struct cbl_field_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:387:8:
note: a different type is defined in another translation unit
387 | struct cbl_field_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:405:8:
note: the first difference of corresponding definitions is field
‘var_decl_node’
405 | tree var_decl_node; // Reference to the pointer to the cblc_field_t
structure
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:405:8:
note: a field of same name but different type is defined in another translation
unit
405 | tree var_decl_node; // Reference to the pointer to the cblc_field_t
structure
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1513:9:
error: type ‘union symbol_elem_u’ violates the C++ One Definition Rule
[-Werror=odr]
1513 | union symbol_elem_u {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1513:9:
note: a different type is defined in another translation unit
1513 | union symbol_elem_u {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1516:31:
note: the first difference of corresponding definitions is field ‘field’
1516 | struct cbl_field_t field;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1516:31:
note: a field of same name but different type is defined in another translation
unit
1516 | struct cbl_field_t field;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:387:8:
note: type ‘struct cbl_field_t’ itself violates the C++ One Definition Rule
387 | struct cbl_field_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1510:8:
error: type ‘struct symbol_elem_t’ violates the C++ One Definition Rule
[-Werror=odr]
1510 | struct symbol_elem_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1510:8:
note: a different type is defined in another translation unit
1510 | struct symbol_elem_t {
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1522:5:
note: the first difference of corresponding definitions is field ‘elem’
1522 | } elem;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1522:5:
note: a field of same name but different type is defined in another translation
unit
1522 | } elem;
| ^
/var/tmp/portage/sys-devel/gcc-15.0.9999/work/gcc-15.0.9999/gcc/cobol/symbols.h:1513:9:
note: type ‘union symbol_elem_u’ itself violates the C++ One Definition Rule
1513 | union symbol_elem_u {
| ^
```