Bug 59971

Summary: multilib_flags is placed with the wrong order
Product: gcc Reporter: H.J. Lu <hjl.tools>
Component: testsuiteAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WONTFIX    
Severity: normal Keywords: patch
Priority: P3    
Version: 4.9.0   
Target Milestone: 5.2   
URL: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01891.html
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2015-02-13 00:00:00

Description H.J. Lu 2014-01-28 21:11:35 UTC
Some testcases need explicit GCC options to properly run, like
gcc.target/i386/sse2-init-v2di-2.c has

/* { dg-options "-O2 -msse4 -march=core2 -dp" } */

-march=core2 is specified explicitly.  But with multlib, we get


[hjl@gnu-18 gcc]$ make check-gcc RUNTESTFLAGS="--target_board='unix{-march=k8}' i386.exp=sse2-init-v2di-2.c"      
make[1]: Entering directory `/export/build/gnu/gcc/build-x86_64-linux/gcc'
test -d plugin || mkdir plugin
test -d testsuite || mkdir testsuite
test -d testsuite/gcc || mkdir testsuite/gcc
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd /export/gnu/import/git/gcc/gcc; ${PWDCMD-pwd}` ; export srcdir ; \
cd testsuite/gcc; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/gcc|' \
	< ../../site.exp > tmp-site.exp; \
/bin/sh ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then  \
   TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
    export TCL_LIBRARY ; fi ; \
runtestflags= ; \
if [ -n "" ] ; then \
  runtestflags=""; \
elif [ -n "" ] ; then \
  parts="`echo '  ' \
	  | sed 's/=[^ ]* / /g'`"; \
  for part in `find $srcdir/testsuite/gcc* -name \*.exp` ; do \
    part=`basename $part` ; \
    case " $parts $runtestflags " in \
      *" $part "*) ;; \
      *) runtestflags="$runtestflags $part" ;; \
    esac ; \
  done ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool gcc --target_board='unix{-march=k8}' i386.exp=sse2-init-v2di-2.c $runtestflags)
WARNING: Couldn't find the global config file.
Test Run By hjl on Tue Jan 28 12:40:33 2014
Native configuration is x86_64-unknown-linux-gnu

		=== gcc tests ===

Schedule of variations:
    unix/-march=k8

Running target unix/-march=k8
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /export/gnu/import/git/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/i386.exp ...
FAIL: gcc.target/i386/sse2-init-v2di-2.c scan-assembler-times vec_concatv2di/3 1

		=== gcc Summary ===

# of expected passes		11
# of unexpected failures	1
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc  version 4.9.0 20140128 (experimental) (GCC) 

make[1]: [check-parallel-gcc] Error 1 (ignored)
make[1]: Leaving directory `/export/build/gnu/gcc/build-x86_64-linux/gcc'

The problem is -march=k8 is placed after -march=core2:

[hjl@gnu-18 gcc]$  grep gcc.target/i386/sse2-init-v2di-2.c testsuite/gcc/gcc.log 
Executing on host: /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ /export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/sse2-init-v2di-2.c  -fno-diagnostics-show-caret -fdiagnostics-color=never  -O2 -msse4 -march=core2 -dp -ffat-lto-objects -S  -march=k8 -o sse2-init-v2di-2.s    (timeout = 300)
spawn -ignore SIGHUP /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ /export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/sse2-init-v2di-2.c -fno-diagnostics-show-caret -fdiagnostics-color=never -O2 -msse4 -march=core2 -dp -ffat-lto-objects -S -march=k8 -o sse2-init-v2di-2.s
PASS: gcc.target/i386/sse2-init-v2di-2.c (test for excess errors)
FAIL: gcc.target/i386/sse2-init-v2di-2.c scan-assembler-times vec_concatv2di/3 1
[hjl@gnu-18 gcc]$ 

It is done by target.exp in dejagnu:

    if {[board_info $dest exists multilib_flags]} {
        append add_flags " [board_info $dest multilib_flags]"
    }

It doesn't work well with such gcc testcases.  It works if we change it to

    if {[board_info $dest exists multilib_flags]} {
        set add_flags "[board_info $dest multilib_flags] $add_flags"
    }
Comment 1 H.J. Lu 2015-02-13 16:18:33 UTC
It leads to

FAIL: gcc.target/i386/pr32219-1.c scan-assembler movl[ \t]xxx@GOTOFF\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-1.c scan-assembler-not movl[ \t]xxx@GOT\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-3.c scan-assembler movl[ \t]xxx@GOTOFF\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-3.c scan-assembler-not movl[ \t]xxx@GOT\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-5.c scan-assembler movl[ \t]xxx@GOTOFF\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-5.c scan-assembler-not movl[ \t]xxx@GOT\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-7.c scan-assembler movl[ \t]xxx@GOTOFF\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr32219-7.c scan-assembler-not movl[ \t]xxx@GOT\\(%[^,]*\\), %eax
FAIL: gcc.target/i386/pr64317.c scan-assembler movl[ \\t]+c@GOTOFF[(]%ebx[)]

in

https://gcc.gnu.org/ml/gcc-regression/2015-02/msg00244.html
Comment 2 Jakub Jelinek 2015-04-22 12:00:27 UTC
GCC 5.1 has been released.
Comment 3 H.J. Lu 2015-04-22 16:42:54 UTC
Fixed by dejagnu 1.5.3 instead.
Comment 4 Andrew Pinski 2017-08-06 20:40:34 UTC
This patch might make sense since RHEL/CentOS 6 still contains a broken dejagnu.