public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] nvptx: Use fatal_error when -march= is missing not an assert [PR111093]
@ 2023-10-16  9:18 Tobias Burnus
  2023-10-18 10:16 ` Thomas Schwinge
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Burnus @ 2023-10-16  9:18 UTC (permalink / raw)
  To: gcc-patches, Tom de Vries, Thomas Schwinge

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

While mkoffload ensures that there is always a -march=, nvptx's
cc1 can also be run directly.

In my case, I wanted to know which target-specific #define are
available; hence, I did run:
   accel/nvptx-none/cc1 -E -dM < /dev/null
which gave an ICE. After some debugging, the reasons was
clear (missing -march=) but somehow a (fatal) error would have been
nicer than an ICE + debugging.

OK for mainline?

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Attachment #2: nvptx-ice-fix.diff --]
[-- Type: text/x-patch, Size: 887 bytes --]

nvptx: Use fatal_error when -march= is missing not an assert [PR111093]

gcc/ChangeLog:

	PR target/111093
	* config/nvptx/nvptx.cc (nvptx_option_override): Issue fatal error
	instead of an assert ICE when no -march= has been specified.

diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index edef39fb5e1..634c31673be 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -335,8 +335,9 @@ nvptx_option_override (void)
   init_machine_status = nvptx_init_machine_status;
 
   /* Via nvptx 'OPTION_DEFAULT_SPECS', '-misa' always appears on the command
-     line.  */
-  gcc_checking_assert (OPTION_SET_P (ptx_isa_option));
+     line; but handle the case that the compiler is not run via the driver.  */
+  if (!OPTION_SET_P (ptx_isa_option))
+    fatal_error (UNKNOWN_LOCATION, "%<-march=%> must be specified");
 
   handle_ptx_version_option ();
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-18 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16  9:18 [Patch] nvptx: Use fatal_error when -march= is missing not an assert [PR111093] Tobias Burnus
2023-10-18 10:16 ` Thomas Schwinge
2023-10-18 16:01   ` Roger Sayle

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).