How to test for errors without line?

Thomas Koenig tkoenig@netcologne.de
Sat Sep 20 21:26:56 GMT 2025


Hi Andreas,

> On Sep 20 2025, Thomas Koenig via Gcc wrote:
> 
>> I can live with that, but it seems a little strange - is there a
>> way to check for an error message that is not associated with
>> a particular line number?
> 
> Use zero as the line number (like gcc.dg/Wfatal-2.c).

I tried to do that, but there is still a mystery.  My test
case now is

! { dg-do compile }
! { dg-options "-ffrontend-optimize -fexternal-blas64" }
! { dg-require-effective-target ilp32 }
! { dg-error "-fexternal-blas64 requires a 64-bit system" 
"matmul_blas_4.f90" { target *-*-* } 0 }
! { dg-error "compilation terminated" "compilation terminated" { target 
*-*-* } 0 }
! PR 121161 - do not use -fexternal-blas64 with a 32-bit system.
subroutine foo(a,b,c,n)
   implicit none
   integer(kind=8) :: n
   real, dimension(n,n) :: a, b, c
   c = matmul(a,b)
end subroutine foo

and I get, when running

make  check-fortran RUNTESTFLAGS="--target_board=unix\{-m32\} 
dg.exp=gfortran.dg/matmul_blas_4.f90"

f951: Fatal Error: -fexternal-blas64 requires a 64-bit system
compilation terminated.
compiler exited with status 1
PASS: gfortran.dg/matmul_blas_4.f90   -O  matmul_blas_4.f90 at line 4 
(test for errors, line )
FAIL: gfortran.dg/matmul_blas_4.f90   -O  compilation terminated at line 
5 (test for errors, line )

and

FAIL: gfortran.dg/matmul_blas_4.f90   -O  (test for excess errors)
Excess errors:
compilation terminated.

There is no typo in the "compilation terminated" regexp because I copied
it from the compiler output :-)

Anything else I might be doing wrong?

Best regards

	Thomas



More information about the Gcc mailing list