This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] ICE with combination of -openmp and -femit-struct-debug-reduced/baseonly‏


I've find out that compiler may crash with SEGFAULT on some openmp-enabled code (attached as debug-1.c) called with the following flags:
 -g -fopenmp -gdwarf-2 -femit-struct-debug-reduced 
Also, can be reproduced with -femit-struct-debug-baseonly

The problem is in dwarf2out.c:350:should_emit_struct_debug() at this line:
366   type_decl = TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type));

In some cases type_decl can be NULL and this causes ICE in the following code:
 368   if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
 369     return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
 370 
 371   if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
 372     return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);

Can be fixed with checking for type_decl is not NULL.

I've attached patch to fix this. Could you check, is it ok?
This is very straightforward fix, can the problem be in incorrect debug info generation on early stages?

Report:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57737

Problem is actual since gcc-4.4 as far as I checked.

/*
With optimism,
Evgeny Gavrin

email : evgeny.gavrin@hotmail.com
*/ 		 	   		  

Attachment: omp-emit-reduced.patch
Description: Binary data

Attachment: debug-1.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]