public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault
@ 2020-08-10  1:32 anbu1024.me at gmail dot com
  2020-08-10  4:03 ` [Bug c/96545] ICE in get_atomic_generic_size marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anbu1024.me at gmail dot com @ 2020-08-10  1:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96545
           Summary: [10/11] internal compiler error: Segmentation fault
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c

extern char x[]; 
extern char y[];
extern char z[];

void foo ()
{
    __atomic_exchange ( & x , & y , & z , & z ) ;
}

-------------------------------------------------------------------------------

$ gcc-snapshot11 --version
gcc (GCC) 11.0.0 20200802 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-------------------------------------------------------------------------------

$ gcc-snapshot11 test.c 
test.c: In function ‘foo’:
test.c:8:5: internal compiler error: Segmentation fault
    8 |     __atomic_exchange ( & x , & y , & z , & z ) ;
      |     ^~~~~~~~~~~~~~~~~
0xdd207f crash_signal
        ../../gcc-11-20200802/gcc/toplev.c:328
0x871826 get_atomic_generic_size
        ../../gcc-11-20200802/gcc/c-family/c-common.c:7021
0x8a164d resolve_overloaded_atomic_exchange
        ../../gcc-11-20200802/gcc/c-family/c-common.c:7219
0x8a164d resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*,
va_gc, vl_embed>*)
        ../../gcc-11-20200802/gcc/c-family/c-common.c:7564
0x82a674 c_build_function_call_vec(unsigned int, vec<unsigned int, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*)
        ../../gcc-11-20200802/gcc/c/c-typeck.c:3202
0x848c1c c_parser_postfix_expression_after_primary
        ../../gcc-11-20200802/gcc/c/c-parser.c:10536
0x840901 c_parser_postfix_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:10209
0x8449fa c_parser_unary_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:8306
0x84620d c_parser_cast_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:8148
0x846499 c_parser_binary_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:7951
0x847475 c_parser_conditional_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:7685
0x847ab0 c_parser_expr_no_commas
        ../../gcc-11-20200802/gcc/c/c-parser.c:7600
0x847d21 c_parser_expression
        ../../gcc-11-20200802/gcc/c/c-parser.c:10672
0x8484c7 c_parser_expression_conv
        ../../gcc-11-20200802/gcc/c/c-parser.c:10705
0x83de7b c_parser_statement_after_labels
        ../../gcc-11-20200802/gcc/c/c-parser.c:6329
0x8400d1 c_parser_compound_statement_nostart
        ../../gcc-11-20200802/gcc/c/c-parser.c:5833
0x85c7b4 c_parser_compound_statement
        ../../gcc-11-20200802/gcc/c/c-parser.c:5645
0x85e20b c_parser_declaration_or_fndef
        ../../gcc-11-20200802/gcc/c/c-parser.c:2533
0x866893 c_parser_external_declaration
        ../../gcc-11-20200802/gcc/c/c-parser.c:1773
0x867389 c_parser_translation_unit
        ../../gcc-11-20200802/gcc/c/c-parser.c:1646
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

-------------------------------------------------------------------------------

$ gcc-snapshot10 --version
gcc (GCC) 10.2.1 20200725
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-------------------------------------------------------------------------------

$ gcc-snapshot10 test.c 
test.c: In function ‘foo’:
test.c:8:5: internal compiler error: Segmentation fault
    8 |     __atomic_exchange ( & x , & y , & z , & z ) ;
      |     ^~~~~~~~~~~~~~~~~
0xaecd9f crash_signal
        ../../gcc-10-20200725/gcc/toplev.c:328
0x65199b get_atomic_generic_size
        ../../gcc-10-20200725/gcc/c-family/c-common.c:6952
0x67d277 resolve_overloaded_atomic_exchange
        ../../gcc-10-20200725/gcc/c-family/c-common.c:7117
0x67d277 resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*,
va_gc, vl_embed>*)
        ../../gcc-10-20200725/gcc/c-family/c-common.c:7462
0x615203 c_build_function_call_vec(unsigned int, vec<unsigned int, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*)
        ../../gcc-10-20200725/gcc/c/c-typeck.c:3199
0x62f5de c_parser_postfix_expression_after_primary
        ../../gcc-10-20200725/gcc/c/c-parser.c:10501
0x627eb1 c_parser_postfix_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:10176
0x62b77a c_parser_unary_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:8273
0x62cefd c_parser_cast_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:8115
0x62d18e c_parser_binary_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:7918
0x62e0c5 c_parser_conditional_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:7652
0x62e5f0 c_parser_expr_no_commas
        ../../gcc-10-20200725/gcc/c/c-parser.c:7569
0x62e851 c_parser_expression
        ../../gcc-10-20200725/gcc/c/c-parser.c:10637
0x62ef57 c_parser_expression_conv
        ../../gcc-10-20200725/gcc/c/c-parser.c:10670
0x62545b c_parser_statement_after_labels
        ../../gcc-10-20200725/gcc/c/c-parser.c:6301
0x6276a1 c_parser_compound_statement_nostart
        ../../gcc-10-20200725/gcc/c/c-parser.c:5805
0x6411c4 c_parser_compound_statement
        ../../gcc-10-20200725/gcc/c/c-parser.c:5617
0x642a35 c_parser_declaration_or_fndef
        ../../gcc-10-20200725/gcc/c/c-parser.c:2505
0x649723 c_parser_external_declaration
        ../../gcc-10-20200725/gcc/c/c-parser.c:1745
0x64a221 c_parser_translation_unit
        ../../gcc-10-20200725/gcc/c/c-parser.c:1618
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
@ 2020-08-10  4:03 ` marxin at gcc dot gnu.org
  2020-08-10 10:42 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-10  4:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-10
            Summary|[10/11] internal compiler   |ICE in
                   |error: Segmentation fault   |get_atomic_generic_size
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
All releases I have ICE (4.8.0+).

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
  2020-08-10  4:03 ` [Bug c/96545] ICE in get_atomic_generic_size marxin at gcc dot gnu.org
@ 2020-08-10 10:42 ` jakub at gcc dot gnu.org
  2020-08-11 14:47 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-10 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49034
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49034&action=edit
gcc11-pr96545.patch

Untested fix.

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
  2020-08-10  4:03 ` [Bug c/96545] ICE in get_atomic_generic_size marxin at gcc dot gnu.org
  2020-08-10 10:42 ` jakub at gcc dot gnu.org
@ 2020-08-11 14:47 ` cvs-commit at gcc dot gnu.org
  2020-08-11 14:48 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-11 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae

commit r11-2648-g7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 11 16:46:49 2020 +0200

    c-family: Fix ICE in get_atomic_generic_size [PR96545]

    As the testcase shows, we would ICE if the type of the first argument of
    various atomic builtins was pointer to (non-void) incomplete type, we would
    assume that TYPE_SIZE_UNIT must be non-NULL.  This patch diagnoses it
    instead.  And also changes the TREE_CODE != INTEGER_CST check to
    !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory
    the int could be too large and not fit.

    2020-08-11  Jakub Jelinek  <jakub@redhat.com>

            PR c/96545
            * c-common.c (get_atomic_generic_size): Require that first
argument's
            type points to a complete type and use tree_fits_uhwi_p instead of
            just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.

            * c-c++-common/pr96545.c: New test.

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-11 14:47 ` cvs-commit at gcc dot gnu.org
@ 2020-08-11 14:48 ` jakub at gcc dot gnu.org
  2020-08-25 17:45 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-11 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
                   ` (3 preceding siblings ...)
  2020-08-11 14:48 ` jakub at gcc dot gnu.org
@ 2020-08-25 17:45 ` cvs-commit at gcc dot gnu.org
  2020-09-16 19:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-25 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r10-8666-gb9bb6a5e12cae44a1cbf298b69f28fc6871f81c8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 11 16:46:49 2020 +0200

    c-family: Fix ICE in get_atomic_generic_size [PR96545]

    As the testcase shows, we would ICE if the type of the first argument of
    various atomic builtins was pointer to (non-void) incomplete type, we would
    assume that TYPE_SIZE_UNIT must be non-NULL.  This patch diagnoses it
    instead.  And also changes the TREE_CODE != INTEGER_CST check to
    !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory
    the int could be too large and not fit.

    2020-08-11  Jakub Jelinek  <jakub@redhat.com>

            PR c/96545
            * c-common.c (get_atomic_generic_size): Require that first
argument's
            type points to a complete type and use tree_fits_uhwi_p instead of
            just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.

            * c-c++-common/pr96545.c: New test.

    (cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae)

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
                   ` (4 preceding siblings ...)
  2020-08-25 17:45 ` cvs-commit at gcc dot gnu.org
@ 2020-09-16 19:22 ` cvs-commit at gcc dot gnu.org
  2020-09-17 17:56 ` jakub at gcc dot gnu.org
  2021-08-08  7:53 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:67627293b4fe2b230c6c32484752adb49f713315

commit r9-8908-g67627293b4fe2b230c6c32484752adb49f713315
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 11 16:46:49 2020 +0200

    c-family: Fix ICE in get_atomic_generic_size [PR96545]

    As the testcase shows, we would ICE if the type of the first argument of
    various atomic builtins was pointer to (non-void) incomplete type, we would
    assume that TYPE_SIZE_UNIT must be non-NULL.  This patch diagnoses it
    instead.  And also changes the TREE_CODE != INTEGER_CST check to
    !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory
    the int could be too large and not fit.

    2020-08-11  Jakub Jelinek  <jakub@redhat.com>

            PR c/96545
            * c-common.c (get_atomic_generic_size): Require that first
argument's
            type points to a complete type and use tree_fits_uhwi_p instead of
            just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.

            * c-c++-common/pr96545.c: New test.

    (cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae)

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
                   ` (5 preceding siblings ...)
  2020-09-16 19:22 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 17:56 ` jakub at gcc dot gnu.org
  2021-08-08  7:53 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For 8.5 fixed in r8-10511-g4ae2e2b9405aff8c242769c8139ce33115df568e and for
9.4+ by the above commit.

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

* [Bug c/96545] ICE in get_atomic_generic_size
  2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
                   ` (6 preceding siblings ...)
  2020-09-17 17:56 ` jakub at gcc dot gnu.org
@ 2021-08-08  7:53 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 90841 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-08-08  7:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  1:32 [Bug c/96545] New: [10/11] internal compiler error: Segmentation fault anbu1024.me at gmail dot com
2020-08-10  4:03 ` [Bug c/96545] ICE in get_atomic_generic_size marxin at gcc dot gnu.org
2020-08-10 10:42 ` jakub at gcc dot gnu.org
2020-08-11 14:47 ` cvs-commit at gcc dot gnu.org
2020-08-11 14:48 ` jakub at gcc dot gnu.org
2020-08-25 17:45 ` cvs-commit at gcc dot gnu.org
2020-09-16 19:22 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:56 ` jakub at gcc dot gnu.org
2021-08-08  7:53 ` pinskia 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).