Bug 47213 - ICE: SIGSEGV in determine_visibility (decl2.c:2076) with -fvisibility-ms-compat
Summary: ICE: SIGSEGV in determine_visibility (decl2.c:2076) with -fvisibility-ms-compat
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 38002 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-07 15:37 UTC by Zdenek Sojka
Modified: 2021-08-12 05:32 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.3.6, 4.4.6, 4.5.3, 4.6.0
Last reconfirmed:


Attachments
reduced testcase (94 bytes, text/plain)
2011-01-07 15:37 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2011-01-07 15:37:07 UTC
Created attachment 22925 [details]
reduced testcase

Compiler output:
$ gcc -fvisibility-ms-compat pr47213.C
==1382== Invalid read of size 2
==1382==    at 0x5B2EAF: determine_visibility (decl2.c:2076)
==1382==    by 0x534F5B: cp_finish_decl (decl.c:6067)
==1382==    by 0x677DD9: pushdecl_top_level_1 (name-lookup.c:3649)
==1382==    by 0x677E24: pushdecl_top_level_and_finish (name-lookup.c:3677)
==1382==    by 0x5F1282: get_tinfo_decl (rtti.c:441)
==1382==    by 0x5F14C5: get_tinfo_ptr (rtti.c:458)
==1382==    by 0x5F19E2: get_typeid (rtti.c:493)
==1382==    by 0x56106A: tsubst_copy_and_build (pt.c:13215)
==1382==    by 0x554C18: tsubst_expr (pt.c:12379)
==1382==    by 0x5559A8: tsubst_expr (pt.c:11955)
==1382==    by 0x554CC8: tsubst_expr (pt.c:12120)
==1382==    by 0x581C41: instantiate_decl (pt.c:17379)
==1382==    by 0x589053: instantiate_pending_templates (pt.c:17476)
==1382==    by 0x5B7321: cp_write_global_declarations (decl2.c:3679)
==1382==    by 0xA245D5: toplev_main (toplev.c:591)
==1382==    by 0x6369BBC: (below main) (in /lib64/libc-2.11.2.so)
==1382==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==1382== 
pr47213.C: In instantiation of 'void bar() [with T = int()]':
pr47213.C:12:19:   instantiated from here
pr47213.C:6:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r168552 - crash
4.3.5, 4.4.5, 4.5.2 - crash
4.2.4 - doesn't know -fvisibility-ms-compat
Comment 1 Kai Tietz 2011-01-13 20:02:01 UTC
Author: ktietz
Date: Thu Jan 13 20:01:57 2011
New Revision: 168763

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168763
Log:
2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* g++.dg/ext/pr47213.C: New.

2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* cp-tree.h (CLASSTYPE_VISIBILITY): Use
	TYPE_MAIN_DECL instead of TYPE_NAME.
	(CLASSTYPE_VISIBILITY_SPECIFIED): Likewise.
	* decl2.c (determine_visibility): Add check
	of CLASS_TYPE_P for underlying_type.

2011-01-13  Kai Tietz  <kai.tietz@onevision.com>

	PR c++/47213
	* config/i386/cygming.h (TARGET_ASM_ASSEMBLE_VISIBILITY):
	PE specific hook.
	* config/i386/i386-protos.h (i386_pe_assemble_visibility):
	New function prototype.
	* config/i386/winnt.c (i386_pe_assemble_visibility):
	Warn only if attribute was specified by user.


Added:
    trunk/gcc/testsuite/g++.dg/ext/pr47213.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/cygming.h
    trunk/gcc/config/i386/i386-protos.h
    trunk/gcc/config/i386/winnt.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/ChangeLog
Comment 2 Kai Tietz 2011-01-13 20:05:18 UTC
Fixed.
Comment 3 Andrew Pinski 2021-08-12 05:32:44 UTC
*** Bug 38002 has been marked as a duplicate of this bug. ***