https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83904
Bug ID: 83904 Summary: gfortran.dg allocatable_function_1 failures Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite Assignee: unassigned at gcc dot gnu.org Reporter: wilson at gcc dot gnu.org Target Milestone: --- Some of my build trees are getting allocatable_function_1 failures. Some of them are not. Looking at this, I see in the failing trees: _gfortran_runtime_error_at (&"At line 30 of file /scratch/jimw/freedom-u-sdk/lra-bug-test/riscv-gnu-toolchain/riscv-gcc/gcc/testsuite/gfortran.dg/ allocatable_function_1.f90"[1]{lb: 1 sz: 1}, &"Attempting to allocate already allocated variable \'%s\'"[1]{lb: 1 sz: 1}, &"foo3"[1]{lb: 1 sz: 1}); The testcase is counting the number of times that the string "free" appears in the dump file, and gets the count wrong when the pathname of the file contains the string "free" because of these gfortran_runtime_error_at calls. I managed to find other examples this problem. For instance: https://gcc.gnu.org/ml/gcc-testresults/2011-12/msg00997.html This is a freebsd testsuite run which happens to contain freebsd in the pathname. Looking for a more unique string would help, e.g. searching for __builtin_free solves my problem, but it would be better if the gfortran_runtime_error_at call was not scanned for strings. If there a gfortran compiler option that avoids the call the testsuite should use it. Otherwise, it might make sense to fix the scanner to ignore lines that include gfortran_runtime_error_at_call. I also noticed that there is a typo in the testcase. There is a comment that says 9 free calls are expected, but the scan-tree-dump-times expects 10. I see that the number changed from 9 to 10 in a 2006-12-05 patch from Paul Thomas, and he fixed the scan-tree-dump-times line, but missed the comment. In the short term, we should fix the comment, and change the search string from free to __builtin_free. In the longer term, we probably need to fix the testsuite to handle this better.