binutils-gdb/gdb/testsuite/lib
Tankut Baris Aktemur 23f3415896 testsuite: add -O0 to Intel compilers if no 'optimize' option is given
icpx/icx give the following warning if '-g' is used without '-O'.

   icpx: remark: Note that use of '-g' without any optimization-level
   option will turn off most compiler optimizations similar to use of
   '-O0'; use '-Rno-debug-disables-optimization' to disable this
   remark [-Rdebug-disables-optimization]

The warning makes dejagnu think that compilation has failed.  E.g.:

  $ make check TESTS="gdb.cp/local.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx"
  ...
  gdb compile failed, icpx: remark: Note that use of '-g' without any optimization-level option will turn off most compiler optimizations similar to use of '-O0'; use '-Rno-debug-disables-optimization' to disable this remark [-Rdebug-disables-optimization]

                  === gdb Summary ===

  # of untested testcases         1

Furthermore, if no -O flag is passed, icx/icc optimize
the code by default.  This breaks assumptions in many GDB tests
that the code is unoptimized by default.  E.g.:

  $ make check TESTS="gdb.cp/cmpd-minsyms.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx"
  ...
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::a() const'
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::b() volatile'
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at 'GDB<int>::c() const volatile'
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::operator ==
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::operator==(GDB<int> const&)
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<char>::harder(char)
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::harder(int)
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at "int GDB<char>::even_harder<int>(char)"
  FAIL: gdb.cp/cmpd-minsyms.exp: gdb_breakpoint: set breakpoint at GDB<int>::simple()

                  === gdb Summary ===

  # of expected passes            1
  # of unexpected failures        9

To fix both problems, pass the -O0 flag explicitly, if no optimization
option is given.

With this patch we get, e.g.:

  $ make check TESTS="gdb.cp/cmpd-minsyms.exp gdb.cp/local.exp" RUNTESTFLAGS="CXX_FOR_TARGET='icpx' CC_FOR_TARGET=icx"
  ...
                  === gdb Summary ===

  # of expected passes            19
  # of known failures             1

Approved-By: Tom Tromey <tom@tromey.com>
2023-01-09 09:50:15 +01:00
..
ada.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
append_gdb_boards_dir.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
attributes.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
build-piece.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
cache.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
check-test-names.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
cl_util.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
cl_util.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
compile-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
compiler.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
compiler.cc Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
compiler.F90 Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
completion-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
cp-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
d-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
dap-support.exp Initial implementation of Debugger Adapter Protocol 2023-01-02 09:49:37 -07:00
data-structures.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
debuginfod-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
dg-add-core-file-count.sh Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
dtrace.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
dwarf.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
fortran.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
future.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
gdb-guile.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
gdb-python.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
gdb-utils.exp [gdb/testsuite] Add xfail in gdb.arch/i386-pkru.exp 2023-01-03 16:41:05 +01:00
gdb.exp testsuite: add -O0 to Intel compilers if no 'optimize' option is given 2023-01-09 09:50:15 +01:00
gdbserver-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
gen-perf-test.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
gnat_debug_info_test.adb
go.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
jit-elf-helpers.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
memory.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
mi-support.exp Initial implementation of Debugger Adapter Protocol 2023-01-02 09:49:37 -07:00
my-syscalls.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
my-syscalls.S Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
notty-wrap Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
objc.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
opencl.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
opencl_hostapp.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
opencl_kernel.cl
pascal.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
pdtrace.in Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
perftest.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
precise-aligned-alloc.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
prelink-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
prompt.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
range-stepping-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
read1.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
rust-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
selftest-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
set_unbuffered_mode.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
sym-info-cmds.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
ton.tcl Initial implementation of Debugger Adapter Protocol 2023-01-02 09:49:37 -07:00
trace-support.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
tuiterm.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
unbuffer_output.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
valgrind.exp Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00