public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109939] New: Invalid return type for __builtin_arm_ssat: Unsigned instead of signed
@ 2023-05-23  8:06 dev at benjarobin dot fr
  2023-05-23  8:13 ` [Bug target/109939] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dev at benjarobin dot fr @ 2023-05-23  8:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109939

            Bug ID: 109939
           Summary: Invalid return type for __builtin_arm_ssat: Unsigned
                    instead of signed
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dev at benjarobin dot fr
  Target Milestone: ---

The warning is triggered with the following test case:

```
int dbg_ssat_out;
int dbg_ssat_in;

void test_arm_ssat(void)
{
    dbg_ssat_out = __builtin_arm_ssat(dbg_ssat_in, 16);
}
```

Compile it using this command line:
arm-none-eabi-gcc -mcpu=cortex-m4 -Wall -Wconversion -c t.c -o t.o

The following output is generated:
```
t.c: In function 'test_arm_ssat':
t.c:7:20: warning: conversion to 'int' from 'unsigned int' may change the sign
of the result [-Wsign-conversion]
    7 |     dbg_ssat_out = __builtin_arm_ssat(dbg_ssat_in, 16);
      |                    ^~~~~~~~~~~~~~~~~~
```

This is an issue since SSAT assembly instruction returns a signed value and not
an unsigned integer.

Maybe this line is wrong (I am not an expert about GCC):
https://github.com/gcc-mirror/gcc/blob/releases/gcc-13.1.0/gcc/config/arm/arm-builtins.cc#L100

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

end of thread, other threads:[~2024-06-04 12:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23  8:06 [Bug target/109939] New: Invalid return type for __builtin_arm_ssat: Unsigned instead of signed dev at benjarobin dot fr
2023-05-23  8:13 ` [Bug target/109939] " pinskia at gcc dot gnu.org
2023-05-23  8:21 ` dev at benjarobin dot fr
2023-05-23  8:52 ` ktkachov at gcc dot gnu.org
2023-05-24  8:33 ` cvs-commit at gcc dot gnu.org
2023-05-24  8:35 ` ktkachov at gcc dot gnu.org
2023-06-08  8:31 ` cvs-commit at gcc dot gnu.org
2023-06-08  8:54 ` cvs-commit at gcc dot gnu.org
2024-06-04 12:49 ` ktkachov at gcc dot gnu.org

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