From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/2] testsuite: add -O0 to Intel compilers if no 'optimize' option is given
Date: Thu, 22 Dec 2022 21:24:17 +0100 [thread overview]
Message-ID: <20221222202417.2042422-2-tankut.baris.aktemur@intel.com> (raw)
In-Reply-To: <20221222202417.2042422-1-tankut.baris.aktemur@intel.com>
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
---
gdb/testsuite/lib/gdb.exp | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 39de114aab2..ee9d9d14bac 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4736,6 +4736,27 @@ proc gdb_compile {source dest type options} {
lappend new_options "additional_flags=-diag-disable=10148"
}
+ # 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'
+ #
+ # The warning makes dejagnu think that compilation has failed.
+ #
+ # Furthermore, if no -O flag is passed, icx and icc optimize
+ # the code by default. This breaks assumptions in many GDB
+ # tests that the code is unoptimized by default.
+ #
+ # To fix both problems, pass the -O0 flag explicitly, if no
+ # optimization option is given.
+ if {[test_compiler_info "icx-*"] || [test_compiler_info "icc-*"]} {
+ if {[lsearch $options optimize=*] == -1
+ && [lsearch $options additional_flags=-O*] == -1} {
+ lappend new_options "optimize=-O0"
+ }
+ }
+
# Starting with 2021.7.0 (recognized as icc-20-21-7 by GDB) icc and
# icpc are marked as deprecated and both compilers emit the remark
# #10441. To let GDB still compile successfully, we disable these
@@ -4780,6 +4801,21 @@ proc gdb_compile {source dest type options} {
# option is not supported so instead use the -module flag.
# Additionally, Intel compilers need the -debug-parameters flag set to
# emit debug info for all parameters in modules.
+ #
+ # ifx gives the following warning if '-g' is used without '-O'.
+ #
+ # ifx: remark #10440: Note that use of a debug option
+ # without any optimization-level option will turnoff most
+ # compiler optimizations similar to use of '-O0'
+ #
+ # The warning makes dejagnu think that compilation has failed.
+ #
+ # Furthermore, if no -O flag is passed, Intel compilers optimize
+ # the code by default. This breaks assumptions in many GDB
+ # tests that the code is unoptimized by default.
+ #
+ # To fix both problems, pass the -O0 flag explicitly, if no
+ # optimization option is given.
if { !$getting_compiler_info && [lsearch -exact $options f90] != -1 } {
# Fortran compile.
set mod_path [standard_output_file ""]
@@ -4789,6 +4825,11 @@ proc gdb_compile {source dest type options} {
|| [test_compiler_info {ifx-*} f90] } {
lappend new_options "additional_flags=-module ${mod_path}"
lappend new_options "additional_flags=-debug-parameters all"
+
+ if {[lsearch $options optimize=*] == -1
+ && [lsearch $options additional_flags=-O*] == -1} {
+ lappend new_options "optimize=-O0"
+ }
}
}
--
2.25.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2022-12-22 20:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-22 20:24 [PATCH 1/2] testsuite: handle icc and icpc deprecated remarks Tankut Baris Aktemur
2022-12-22 20:24 ` Tankut Baris Aktemur [this message]
2023-01-05 19:59 ` [PATCH 2/2] testsuite: add -O0 to Intel compilers if no 'optimize' option is given Tom Tromey
2023-01-05 19:57 ` [PATCH 1/2] testsuite: handle icc and icpc deprecated remarks Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221222202417.2042422-2-tankut.baris.aktemur@intel.com \
--to=tankut.baris.aktemur@intel.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).