public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix Ada-QNX task priority conversion
@ 2022-05-18  8:43 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-18  8:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: Johannes Kliemann

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

The conversion between OS and Ada priorties should be done in the wider
Interfaces.C.int type rather than Any_Priority otherwise
Constraint_Error will be raised when coverting Any_Priority'Last to int.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* libgnarl/s-osinte__qnx.adb (To_Target_Priority): Perform
	arithmetic in int.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 437 bytes --]

diff --git a/gcc/ada/libgnarl/s-osinte__qnx.adb b/gcc/ada/libgnarl/s-osinte__qnx.adb
--- a/gcc/ada/libgnarl/s-osinte__qnx.adb
+++ b/gcc/ada/libgnarl/s-osinte__qnx.adb
@@ -87,7 +87,7 @@ package body System.OS_Interface is
      (Prio : System.Any_Priority) return Interfaces.C.int
    is
    begin
-      return Interfaces.C.int (Prio + 1);
+      return Interfaces.C.int (Prio) + 1;
    end To_Target_Priority;
 
    -----------------



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-18  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  8:43 [Ada] Fix Ada-QNX task priority conversion Pierre-Marie de Rodat

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