the same as for @code{dg-skip-if}) are met.
@end table
+@subsubsection Expect the compiler to crash
+
+@table @code
+@item @{ dg-ice @var{comment} [@{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]]] @}
+Expect the compiler to crash with an internal compiler error and return
+a nonzero exit status if the conditions (which are the same as for
+@code{dg-skip-if}) are met. Used for tests that test bugs that have not been
+fixed yet.
+@end table
+
@subsubsection Expect the test executable to fail
@table @code
verbose "$target_compile $prog $output_file $compile_type $options" 4
set comp_output [$target_compile "$prog" "$output_file" "$compile_type" $options]
+ global expect_ice
# Look for an internal compiler error, which sometimes masks the fact
# that we didn't get an expected error message. XFAIL an ICE via
# dg-xfail-if and use { dg-prune-output ".*internal compiler error.*" }
# to avoid a second failure for excess errors.
- if [string match "*internal compiler error*" $comp_output] {
+ # "Error reporting routines re-entered" ICE says "Internal" rather than
+ # "internal", so match that too.
+ if [string match {*[Ii]nternal compiler error*} $comp_output] {
upvar 2 name name
- fail "$name (internal compiler error)"
+ if { $expect_ice == 0 } {
+ fail "$name (internal compiler error)"
+ } else {
+ # We expected an ICE and we got it.
+ xfail "$name (internal compiler error)"
+ # Prune the ICE from the output.
+ set comp_output [prune_ices $comp_output]
+ }
+ } elseif { $expect_ice == 1 } {
+ upvar 2 name name
+ # We expected an ICE but we didn't get it.
+ xpass "$name (internal compiler error)"
}
if { $do_what == "repo" } {
global additional_prunes
global compiler_conditional_xfail_data
global shouldfail
+ global expect_ice
global testname_with_flags
global set_target_env_var
global set_compiler_env_var
set additional_sources_used ""
set additional_prunes ""
set shouldfail 0
+ set expect_ice 0
if [info exists set_target_env_var] {
unset set_target_env_var
}
return $text
}
+# Prune internal compiler error messages, including the "Please submit..."
+# footnote.
+
+proc prune_ices { text } {
+ regsub -all "(^|\n)\[^\n\]*: internal compiler error:.*for instructions\[^\n\]*" $text "" text
+ regsub -all "(^|\n|')*Internal compiler error:.*for instructions\[^\n\]*" $text "" text
+ return $text
+}
+
# Provide a definition of this if missing (delete after next dejagnu release).
if { [info procs prune_warnings] == "" } then {
}
}
+# Record whether the compiler is expected (at the moment) to ICE.
+# Used for tests that test bugs that have not been fixed yet.
+
+set expect_ice 0
+
+proc dg-ice { args } {
+ # Don't bother if we're already skipping the test.
+ upvar dg-do-what dg-do-what
+ if { [lindex ${dg-do-what} 1] == "N" } {
+ return
+ }
+
+ global expect_ice
+
+ set args [lreplace $args 0 0]
+ if { [llength $args] > 1 } {
+ set selector [list target [lindex $args 1]]
+ if { [dg-process-target-1 $selector] == "S" } {
+ # The target matches, now check the flags.
+ if [check-flags $args] {
+ set expect_ice 1
+ }
+ }
+ } else {
+ set expect_ice 1
+ }
+}
+
# Intercept the call to the DejaGnu version of dg-process-target to
# support use of an effective-target keyword in place of a list of
# target triplets to xfail or skip a test.