re PR pch/54117 (FAIL: ./decl-3.h -O0 -g (internal compiler error))

PR pch/54117
	* c-opts.c (c_common_post_options): If debug info is enabled
	and non-dwarf*, refuse to load PCH files and when writing PCH
	file warn.

	* lib/dg-pch.exp (pch-init, pch-finish,
	check_effective_target_pch_supported_debug): New procs.
	(dg-flags-pch): If $pch_unsupported, make tests UNSUPPORTED.
	Likewise if $pch_unsupported_debug and $flags include -g.
	Skip FAILs about missing *.gch file if $pch_unsupported_debug
	and dg-require-effective-target pch_unsupported_debug.
	* g++.dg/pch/pch.exp: Call pch-init and pch-finish.
	* objc.dg/pch/pch.exp: Likewise.
	* gcc.dg/pch/pch.exp: Likewise.
	* gcc.dg/pch/valid-1.c: Add dg-require-effective-target
	pch_unsupported_debug.
	* gcc.dg/pch/valid-1.hs: Likewise.
	* gcc.dg/pch/valid-1b.c: Likewise.
	* gcc.dg/pch/valid-1b.hs: Likewise.

Co-Authored-By: Steven Bosscher <steven@gcc.gnu.org>

From-SVN: r196124
This commit is contained in:
Jakub Jelinek 2013-02-18 20:42:56 +01:00 committed by Jakub Jelinek
parent 3f587ca369
commit f6007d99f8
11 changed files with 96 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2013-02-18 Jakub Jelinek <jakub@redhat.com>
Steven Bosscher <steven@gcc.gnu.org>
PR pch/54117
* c-opts.c (c_common_post_options): If debug info is enabled
and non-dwarf*, refuse to load PCH files and when writing PCH
file warn.
2013-02-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/56167

View File

@ -945,6 +945,16 @@ c_common_post_options (const char **pfilename)
because the default address space slot then can't be used
for the output PCH file. */
if (pch_file)
{
c_common_no_more_pch ();
/* Only -g0 and -gdwarf* are supported with PCH, for other
debug formats we warn here and refuse to load any PCH files. */
if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
warning (OPT_Wdeprecated,
"the \"%s\" debug format cannot be used with "
"pre-compiled headers", debug_type_names[write_symbols]);
}
else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
c_common_no_more_pch ();
/* Yuk. WTF is this? I do know ObjC relies on it somewhere. */

View File

@ -1,3 +1,21 @@
2013-02-18 Jakub Jelinek <jakub@redhat.com>
PR pch/54117
* lib/dg-pch.exp (pch-init, pch-finish,
check_effective_target_pch_supported_debug): New procs.
(dg-flags-pch): If $pch_unsupported, make tests UNSUPPORTED.
Likewise if $pch_unsupported_debug and $flags include -g.
Skip FAILs about missing *.gch file if $pch_unsupported_debug
and dg-require-effective-target pch_unsupported_debug.
* g++.dg/pch/pch.exp: Call pch-init and pch-finish.
* objc.dg/pch/pch.exp: Likewise.
* gcc.dg/pch/pch.exp: Likewise.
* gcc.dg/pch/valid-1.c: Add dg-require-effective-target
pch_unsupported_debug.
* gcc.dg/pch/valid-1.hs: Likewise.
* gcc.dg/pch/valid-1b.c: Likewise.
* gcc.dg/pch/valid-1b.hs: Likewise.
2013-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/56366

View File

@ -23,6 +23,7 @@ load_lib dg-pch.exp
# Initialize `dg'.
dg-init
pch-init
set old_dg_do_what_default "${dg-do-what-default}"
@ -36,4 +37,5 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] {
set dg-do-what-default "$old_dg_do_what_default"
# All done.
pch-finish
dg-finish

View File

@ -26,6 +26,7 @@ load_lib torture-options.exp
dg-init
torture-init
set-torture-options $DG_TORTURE_OPTIONS
pch-init
set old_dg_do_what_default "${dg-do-what-default}"
@ -59,5 +60,6 @@ file delete $testh
set dg-do-what-default "$old_dg_do_what_default"
# All done.
pch-finish
torture-finish
dg-finish

View File

@ -1,3 +1,4 @@
/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g" } */
#include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */

View File

@ -1,3 +1,4 @@
/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g0" } */
extern int x;

View File

@ -1,3 +1,4 @@
/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g0" } */
#include "valid-1b.h"

View File

@ -1,3 +1,4 @@
/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g" } */
extern int x;

View File

@ -16,8 +16,49 @@
load_lib copy-file.exp
proc pch-init { args } {
global pch_unsupported_debug pch_unsupported
if [info exists pch_unsupported_debug] {
error "pch-init: pch_unsupported_debug is not empty as expected"
}
if [info exists pch_unsupported] {
error "pch-init: pch_unsupported is not empty as expected"
}
set result [check_compile pchtest object "int i;" "-g -x c-header"]
set pch_unsupported_debug \
[regexp "debug format cannot be used with pre-compiled headers" \
[lindex $result 0]]
set pch_unsupported 0
if { $pch_unsupported_debug } {
verbose -log "pch is unsupported with the debug info format"
set result [check_compile pchtest object "int i;" "-x c-header"]
set pch_unsupported \
[regexp "debug format cannot be used with pre-compiled headers" \
[lindex $result 0]]
}
}
proc pch-finish { args } {
global pch_unsupported_debug pch_unsupported
unset pch_unsupported_debug
unset pch_unsupported
}
proc check_effective_target_pch_supported_debug { } {
global pch_unsupported_debug
if { $pch_unsupported_debug } {
return 0
}
return 1
}
proc dg-flags-pch { subdir test otherflags options suffix } {
global runtests dg-do-what-default
global pch_unsupported_debug pch_unsupported
# If we're only testing specific files and this isn't one of them, skip it.
if ![runtest_file_p $runtests $test] {
@ -35,6 +76,13 @@ proc dg-flags-pch { subdir test otherflags options suffix } {
foreach flags $options {
verbose "Testing $nshort, $otherflags $flags" 1
if { $pch_unsupported != 0 \
|| ( $pch_unsupported_debug != 0 && [regexp " -g" " $flags"] ) } {
verbose -log "$nshort unsupported because debug format conflicts with PCH"
unsupported "$nshort $flags"
continue
}
# For the header files, the default is to precompile.
set dg-do-what-default precompile
catch { file_on_host delete "$bname$suffix" }
@ -78,7 +126,8 @@ proc dg-flags-pch { subdir test otherflags options suffix } {
fail "$nshort $flags assembly comparison"
}
}
} else {
} elseif { $pch_unsupported_debug == 0 \
|| [llength [grep $test "{\[ \t\]\+dg-require-effective-target\[ \t\]\+pch_supported_debug\[ \t\]\+.*\[ \t\]\+}"]] > 0 } {
verbose -log "pch file '$bname$suffix.gch' missing"
fail "$nshort $flags"
if { !$have_errs } {

View File

@ -24,8 +24,8 @@ load_lib torture-options.exp
# Initialize `dg'.
dg-init
torture-init
pch-init
set-torture-options $DG_TORTURE_OPTIONS
@ -59,5 +59,6 @@ if [istarget "*-*-darwin*" ] {
set dg-do-what-default "$old_dg_do_what_default"
# All done.
pch-finish
torture-finish
dg-finish