public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96139] New: Vector element extract mistypes long long int down to long int
@ 2020-07-09 19:44 munroesj at gcc dot gnu.org
  2020-07-09 20:05 ` [Bug c/96139] " munroesj at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: munroesj at gcc dot gnu.org @ 2020-07-09 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96139
           Summary: Vector element extract mistypes long long int down to
                    long int
           Product: gcc
           Version: 9.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: munroesj at gcc dot gnu.org
  Target Milestone: ---

When printing vector element for example:
  printf ("%s %016llx,%016llx\n", prefix, val[1], val[0]);

where val is a vector unsigned long long int -Wall reports:

../src/printll.c: In function ‘print_v2xint64’:
../src/printll.c:20:21: warning: format ‘%llx’ expects argument of type ‘long
long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
   printf ("%s %016llx,%016llx\n", prefix, val[1], val[0]);
                     ^

Here gcc claims that val[1] is a ‘long unsigned int’ then it is actually typed
as:

typedef __vector unsigned long long int vui64_t;

Some how the vector element extract has dropped the long long int type to long
int. This should not be an issue for PPC64 as long long int and long int are
both 64-bit but would matter for PPC32.

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

* [Bug c/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
@ 2020-07-09 20:05 ` munroesj at gcc dot gnu.org
  2020-07-09 22:01 ` [Bug target/96139] " wschmidt at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: munroesj at gcc dot gnu.org @ 2020-07-09 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Steven Munroe <munroesj at gcc dot gnu.org> ---
Created attachment 48851
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48851&action=edit
Test case for printf of vector long long int elements

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
  2020-07-09 20:05 ` [Bug c/96139] " munroesj at gcc dot gnu.org
@ 2020-07-09 22:01 ` wschmidt at gcc dot gnu.org
  2020-07-10  0:34 ` munroesj at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-07-09 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Have you tried it for -m32, out of curiosity?

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
  2020-07-09 20:05 ` [Bug c/96139] " munroesj at gcc dot gnu.org
  2020-07-09 22:01 ` [Bug target/96139] " wschmidt at gcc dot gnu.org
@ 2020-07-10  0:34 ` munroesj at gcc dot gnu.org
  2020-07-10  7:28 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: munroesj at gcc dot gnu.org @ 2020-07-10  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Steven Munroe <munroesj at gcc dot gnu.org> ---
(In reply to Bill Schmidt from comment #2)
> Have you tried it for -m32, out of curiosity?

no

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-07-10  0:34 ` munroesj at gcc dot gnu.org
@ 2020-07-10  7:28 ` rguenth at gcc dot gnu.org
  2020-07-16 23:03 ` willschm at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-10  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2020-07-10
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that 'val' has

 <vector_type 0x7ffff69f8c78 vui64_t
    type <integer_type 0x7ffff6bc97e0 long unsigned int public unsigned DI
        size <integer_cst 0x7ffff6bc7030 constant 64>
        unit-size <integer_cst 0x7ffff6bc7048 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6bc97e0 precision:64 min <integer_cst 0x7ffff6bc7300 0> max <integer_cst
0x7ffff6bb85a0 18446744073709551615>
        pointer_to_this <pointer_type 0x7ffff6bd7e70>>
    unsigned V2DI
    size <integer_cst 0x7ffff6bc7078 type <integer_type 0x7ffff6bc90a8
bitsizetype> constant 128>
    unit-size <integer_cst 0x7ffff6bc7090 type <integer_type 0x7ffff6bc9000
sizetype> constant 16>
    align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6cae000 nunits:2>

so the error is in processing of the __vector typedef, not in the
element extract.  IIRC __vector is a ppc specific keyword thus target
code is likely the culprit here.

It's also wrong-code for TBAA btw, accessing a unsigned long long[]
via ui64_t would be invalid.

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-10  7:28 ` rguenth at gcc dot gnu.org
@ 2020-07-16 23:03 ` willschm at gcc dot gnu.org
  2020-09-03 20:11 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-07-16 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

Will Schmidt <willschm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |willschm at gcc dot gnu.org

--- Comment #5 from Will Schmidt <willschm at gcc dot gnu.org> ---
(In reply to Bill Schmidt from comment #2)
> Have you tried it for -m32, out of curiosity?

Local experimentation indicates building with -m32 does not report the warning.

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-07-16 23:03 ` willschm at gcc dot gnu.org
@ 2020-09-03 20:11 ` cvs-commit at gcc dot gnu.org
  2020-09-15 17:17 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-03 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Will Schmidt <willschm@gcc.gnu.org>:

https://gcc.gnu.org/g:d8f3474ff81b07fd2e758337957711db17eb801e

commit r11-3002-gd8f3474ff81b07fd2e758337957711db17eb801e
Author: Will Schmidt <will_schmidt@vnet.ibm.com>
Date:   Mon Jul 20 10:51:37 2020 -0500

    [PATCH, rs6000] Fix vector long long subtype (PR96139)

    Hi,
      This corrects an issue with the powerpc vector long long subtypes.
    As reported by SjMunroe, when building some code with -Wall, and
    attempting to print an element of a "long long vector" with a
    long long printf format string, we will report an error because
    the vector sub-type was improperly defined as int.

    When defining a V2DI_type_node we use a TARGET_POWERPC64 ternary to
    define the V2DI_type_node with "vector long" or "vector long long".
    We also need to specify the proper sub-type when we define the type.

    PR target/96139

    2020-09-03  Will Schmidt  <will_schmidt@vnet.ibm.com>

    gcc/ChangeLog:
            * config/rs6000/rs6000-call.c (rs6000_init_builtin): Update
V2DI_type_node
            and unsigned_V2DI_type_node definitions.

    gcc/testsuite/ChangeLog:
            * gcc.target/powerpc/pr96139-a.c: New test.
            * gcc.target/powerpc/pr96139-b.c: New test.
            * gcc.target/powerpc/pr96139-c.c: New test.

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-09-03 20:11 ` cvs-commit at gcc dot gnu.org
@ 2020-09-15 17:17 ` cvs-commit at gcc dot gnu.org
  2020-09-15 20:50 ` willschm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-15 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Will Schmidt
<willschm@gcc.gnu.org>:

https://gcc.gnu.org/g:ba0bc8fa005921832c4665e5b5a18932d3f4ccf4

commit r10-8766-gba0bc8fa005921832c4665e5b5a18932d3f4ccf4
Author: Will Schmidt <will_schmidt@vnet.ibm.com>
Date:   Mon Jul 20 10:51:37 2020 -0500

    [PATCH, rs6000] Fix vector long long subtype (PR96139)

    Hi,
      This corrects an issue with the powerpc vector long long subtypes.
    As reported by SjMunroe, when building some code with -Wall, and
    attempting to print an element of a "long long vector" with a
    long long printf format string, we will report an error because
    the vector sub-type was improperly defined as int.

    When defining a V2DI_type_node we use a TARGET_POWERPC64 ternary to
    define the V2DI_type_node with "vector long" or "vector long long".
    We also need to specify the proper sub-type when we define the type.

    PR target/96139

    2020-09-03  Will Schmidt  <will_schmidt@vnet.ibm.com>

    gcc/ChangeLog:
            * config/rs6000/rs6000-call.c (rs6000_init_builtin): Update
V2DI_type_node
            and unsigned_V2DI_type_node definitions.

    gcc/testsuite/ChangeLog:
            * gcc.target/powerpc/pr96139-a.c: New test.
            * gcc.target/powerpc/pr96139-b.c: New test.
            * gcc.target/powerpc/pr96139-c.c: New test.

    (cherry picked from commit d8f3474ff81b07fd2e758337957711db17eb801e)

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-09-15 17:17 ` cvs-commit at gcc dot gnu.org
@ 2020-09-15 20:50 ` willschm at gcc dot gnu.org
  2020-09-15 21:46 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-09-15 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

Will Schmidt <willschm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kelvin at gcc dot gnu.org

--- Comment #8 from Will Schmidt <willschm at gcc dot gnu.org> ---
*** Bug 85198 has been marked as a duplicate of this bug. ***

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-09-15 20:50 ` willschm at gcc dot gnu.org
@ 2020-09-15 21:46 ` cvs-commit at gcc dot gnu.org
  2020-09-15 22:13 ` willschm at gcc dot gnu.org
  2020-09-16 16:28 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-15 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Will Schmidt
<willschm@gcc.gnu.org>:

https://gcc.gnu.org/g:04a9b796436c68a07c052805631e962a1126dcca

commit r9-8872-g04a9b796436c68a07c052805631e962a1126dcca
Author: Will Schmidt <will_schmidt@vnet.ibm.com>
Date:   Tue Sep 15 15:06:08 2020 -0500

    [PATCH, rs6000] Fix vector long long subtype (PR96139)

    Hi,
      This corrects an issue with the powerpc vector long long subtypes.
    As reported by SjMunroe, when building some code with -Wall, and
    attempting to print an element of a "long long vector" with a
    long long printf format string, we will report an error because
    the vector sub-type was improperly defined as int.

    When defining a V2DI_type_node we use a TARGET_POWERPC64 ternary to
    define the V2DI_type_node with "vector long" or "vector long long".
    We also need to specify the proper sub-type when we define the type.

    Due to some file renames, This is a backport and rework of both
        [PATCH, rs6000] Fix vector long long subtype (PR96139)
    and
        [PATCH, rs6000] Testsuite fixup pr96139 tests


    PR target/96139

    2020-09-03  Will Schmidt  <will_schmidt@vnet.ibm.com>

    gcc/ChangeLog:
            * config/rs6000/rs6000.c (rs6000_init_builtin): Update
V2DI_type_node
            and unsigned_V2DI_type_node definitions.

    gcc/testsuite/ChangeLog:
            * gcc.target/powerpc/pr96139-a.c: New test.
            * gcc.target/powerpc/pr96139-b.c: New test.
            * gcc.target/powerpc/pr96139-c.c: New test.

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-09-15 21:46 ` cvs-commit at gcc dot gnu.org
@ 2020-09-15 22:13 ` willschm at gcc dot gnu.org
  2020-09-16 16:28 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-09-15 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

Will Schmidt <willschm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Will Schmidt <willschm at gcc dot gnu.org> ---
fix committed. closing out.

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

* [Bug target/96139] Vector element extract mistypes long long int down to long int
  2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2020-09-15 22:13 ` willschm at gcc dot gnu.org
@ 2020-09-16 16:28 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Will Schmidt
<willschm@gcc.gnu.org>:

https://gcc.gnu.org/g:74c624523bdbe4329c7cb77bff222ac695e36c95

commit r8-10453-g74c624523bdbe4329c7cb77bff222ac695e36c95
Author: Will Schmidt <will_schmidt@vnet.ibm.com>
Date:   Wed Sep 16 11:21:04 2020 -0500

    [PATCH, rs6000] Fix vector long long subtype (PR96139)

    Hi,
    This corrects an issue with the powerpc vector long long subtypes.
    As reported by SjMunroe, when building some code with -Wall, and
    attempting to print an element of a "long long vector" with a
    long long printf format string, we will report an error because
    the vector sub-type was improperly defined as int.

    When defining a V2DI_type_node we use a TARGET_POWERPC64 ternary to
    define the V2DI_type_node with "vector long" or "vector long long".
    We also need to specify the proper sub-type when we define the type.

    Due to some file renames, This is a backport and rework of both
        [PATCH, rs6000] Fix vector long long subtype (PR96139)
    and
        [PATCH, rs6000] Testsuite fixup pr96139 tests


            PR target/96139

    gcc/ChangeLog:
            * config/rs6000/rs6000.c (rs6000_init_builtin): Update
V2DI_type_node
              and unsigned_V2DI_type_node definitions.

    gcc/testsuite/ChangeLog:
            * gcc.target/powerpc/pr96139-a.c: New test.
            * gcc.target/powerpc/pr96139-b.c: New test.
            * gcc.target/powerpc/pr96139-c.c: New test.

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

end of thread, other threads:[~2020-09-16 16:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 19:44 [Bug c/96139] New: Vector element extract mistypes long long int down to long int munroesj at gcc dot gnu.org
2020-07-09 20:05 ` [Bug c/96139] " munroesj at gcc dot gnu.org
2020-07-09 22:01 ` [Bug target/96139] " wschmidt at gcc dot gnu.org
2020-07-10  0:34 ` munroesj at gcc dot gnu.org
2020-07-10  7:28 ` rguenth at gcc dot gnu.org
2020-07-16 23:03 ` willschm at gcc dot gnu.org
2020-09-03 20:11 ` cvs-commit at gcc dot gnu.org
2020-09-15 17:17 ` cvs-commit at gcc dot gnu.org
2020-09-15 20:50 ` willschm at gcc dot gnu.org
2020-09-15 21:46 ` cvs-commit at gcc dot gnu.org
2020-09-15 22:13 ` willschm at gcc dot gnu.org
2020-09-16 16:28 ` cvs-commit 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).