public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type
@ 2020-11-25 14:48 pascal_cuoq at hotmail dot com
  2020-11-25 21:33 ` [Bug c/97986] " joseph at codesourcery dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pascal_cuoq at hotmail dot com @ 2020-11-25 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97986
           Summary: ICE in force_constant_size when applying va_arg to VLA
                    type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pascal_cuoq at hotmail dot com
  Target Milestone: ---

This bug seems most similar to (but still different from)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59711 (in which a comment says
that it appears to have been fixed in GCC 6).

In GCC 10.2 and some earlier versions, compiling the following program
(Compiler Explorer link: https://gcc.godbolt.org/z/11ob5j ):

#include <stdarg.h>

int sum(int n, ...)
{
    va_list ap;
    va_start(ap, n);
    int *input = va_arg(ap, int[n]);
    int rc = 0;
    for (int i = 0; i < n; i++)
        rc += input[i];
    return rc;
}

Produces the following error message:

In file included from <source>:1:
<source>: In function 'sum':
<source>:7:29: internal compiler error: in force_constant_size, at
gimplify.c:733
    7 |     int *input = va_arg(ap, int[n]);
      |                             ^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

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

* [Bug c/97986] ICE in force_constant_size when applying va_arg to VLA type
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
@ 2020-11-25 21:33 ` joseph at codesourcery dot com
  2022-01-03 21:05 ` [Bug c/97986] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2020-11-25 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I guess this should be handled like va_arg for float: give a warning about 
the type passed, then generate an abort (making sure that side-effects in 
both arguments take effect before the abort, in case a side-effect 
involves calling longjmp or exit).

(Technically a fixed-size array type argument to va_arg could be used in 
C90 mode to retrieve a non-lvalue array passed by value as a function 
argument, but the result would just be another non-lvalue array with no 
way to access the array elements, so just as useless as all other cases of 
non-lvalue arrays in C90.  So although specifying any array type as the 
second argument to va_arg is very dubious, maybe the case of a non-VLA in 
C90 mode should not generate an abort.)

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

* [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
  2020-11-25 21:33 ` [Bug c/97986] " joseph at codesourcery dot com
@ 2022-01-03 21:05 ` pinskia at gcc dot gnu.org
  2022-01-03 21:27 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection
   Last reconfirmed|                            |2022-01-03
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|ICE in force_constant_size  |[9/10/11/12 Regression] ICE
                   |when applying va_arg to VLA |in force_constant_size when
                   |type                        |applying va_arg to VLA type

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, This ICE started in GCC 6 even.

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

* [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
  2020-11-25 21:33 ` [Bug c/97986] " joseph at codesourcery dot com
  2022-01-03 21:05 ` [Bug c/97986] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-03 21:27 ` pinskia at gcc dot gnu.org
  2022-01-17 15:05 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5

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

* [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
                   ` (2 preceding siblings ...)
  2022-01-03 21:27 ` pinskia at gcc dot gnu.org
@ 2022-01-17 15:05 ` rguenth at gcc dot gnu.org
  2022-01-31 15:54 ` [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4 marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
                   ` (3 preceding siblings ...)
  2022-01-17 15:05 ` rguenth at gcc dot gnu.org
@ 2022-01-31 15:54 ` marxin at gcc dot gnu.org
  2022-05-27  9:43 ` [Bug c/97986] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-31 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |vries at gcc dot gnu.org
            Summary|[9/10/11/12 Regression] ICE |[9/10/11/12 Regression] ICE
                   |in force_constant_size when |in force_constant_size when
                   |applying va_arg to VLA type |applying va_arg to VLA type
                   |                            |since
                   |                            |r6-91-gf8e89441bc5518f4
           Keywords|needs-bisection             |

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r6-91-gf8e89441bc5518f4.

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

* [Bug c/97986] [10/11/12/13 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
                   ` (4 preceding siblings ...)
  2022-01-31 15:54 ` [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4 marxin at gcc dot gnu.org
@ 2022-05-27  9:43 ` rguenth at gcc dot gnu.org
  2022-06-28 10:42 ` jakub at gcc dot gnu.org
  2023-07-07 10:38 ` [Bug c/97986] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c/97986] [10/11/12/13 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
                   ` (5 preceding siblings ...)
  2022-05-27  9:43 ` [Bug c/97986] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:42 ` jakub at gcc dot gnu.org
  2023-07-07 10:38 ` [Bug c/97986] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c/97986] [11/12/13/14 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4
  2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
                   ` (6 preceding siblings ...)
  2022-06-28 10:42 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:38 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 14:48 [Bug c/97986] New: ICE in force_constant_size when applying va_arg to VLA type pascal_cuoq at hotmail dot com
2020-11-25 21:33 ` [Bug c/97986] " joseph at codesourcery dot com
2022-01-03 21:05 ` [Bug c/97986] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-03 21:27 ` pinskia at gcc dot gnu.org
2022-01-17 15:05 ` rguenth at gcc dot gnu.org
2022-01-31 15:54 ` [Bug c/97986] [9/10/11/12 Regression] ICE in force_constant_size when applying va_arg to VLA type since r6-91-gf8e89441bc5518f4 marxin at gcc dot gnu.org
2022-05-27  9:43 ` [Bug c/97986] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07 10:38 ` [Bug c/97986] [11/12/13/14 " rguenth 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).