Bug 40902 - LTO doesn't merge CV differences properly
Summary: LTO doesn't merge CV differences properly
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Richard Biener
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-07-29 13:36 UTC by Richard Biener
Modified: 2009-10-05 14:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-09-30 15:27:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2009-07-29 13:36:22 UTC
From 464.h264ref we can see that for

t1.c
const int i[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

t2.c
extern int i[10];
int main () { return i[0]; }

we should merge both decls, retaining the const qualification (the middle-end
considers both types compatible, lto_symtab_compatible doesn't).
Comment 1 Ben Elliston 2009-07-31 00:00:14 UTC
Yes, this seems wrong.
Comment 2 Richard Biener 2009-09-30 15:27:01 UTC
Mine.
Comment 3 Richard Biener 2009-10-05 14:28:00 UTC
Subject: Bug 40902

Author: rguenth
Date: Mon Oct  5 14:27:39 2009
New Revision: 152452

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152452
Log:
2009-10-05  Richard Guenther  <rguenther@suse.de>

	PR lto/40902
	* lto-symtab.c (lto_compatible_attributes_p): Remove.
	(external_aggregate_decl_p): Likewise.
	(lto_symtab_compatible): Re-structure.  Remove dead code.
	For variables ignore toplevel qualifiers when comparing types.
	Issue warnings, not errors for mismatched user-alignment.

	* gcc.dg/lto/20091005-1_0.c: New testcase.
	* gcc.dg/lto/20091005-1_1.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/20091005-1_0.c
    trunk/gcc/testsuite/gcc.dg/lto/20091005-1_1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lto-symtab.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Richard Biener 2009-10-05 14:28:45 UTC
Fixed.