From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21721 invoked by alias); 11 Aug 2010 23:52:24 -0000 Received: (qmail 21647 invoked by uid 48); 11 Aug 2010 23:52:12 -0000 Date: Wed, 11 Aug 2010 23:52:00 -0000 Message-ID: <20100811235212.21646.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/41091] Using section attribute in c and c++ function causes section type conflict In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "roland at redhat dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00921.txt.bz2 ------- Comment #4 from roland at redhat dot com 2010-08-11 23:52 ------- The compiler is being internally inconsistent here. It somtimes decides that __attribute__((section ("name"))) means a "name" section in a COMDAT group, and sometimes decides that it means just a plain "name" section. If it's going to have that behavior implicitly, then it should not call this a conflict. Instead, it should implicitly recognize that the particular COMDAT version of "name" is a different animal than the non-COMDAT "name". In fact, it has an arguably more severe version of this bug too: class C { public: void m() { static int TWO __attribute__((section(".consts"))) = 2; } }; class D { public: void m() { static int THREE __attribute__((section(".consts"))) = 2; } }; int main (int argc, char **argv) { C inst = C(); inst.m(); D inst2 = D(); inst2.m(); return 0; } For that, it happily puts TWO and THREE initializers both in the COMDAT group for C::m()::TWO, which is quite clearly wrong. The left hand uses multiple different sections of the same name, but the right hand thinks that any section matching the simple name it's looking for is the same thing regardless of whether or not its a distinct COMDAT variant. -- roland at redhat dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roland at redhat dot com, | |jakub at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41091