public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size
@ 2021-11-24 17:45 gscfq@t-online.de
  2021-11-24 17:59 ` [Bug fortran/103412] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-24 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103412
           Summary: [10/11/12 Regression] ICE: Invalid expression in
                    gfc_element_size
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started with r10, between 20190630 and 20190728 :
(a few small remnants of the BOZ revision)


$ cat z1.f90
program p
   integer, parameter :: a = sizeof(z'1')
end


$ gfortran-12-20211121 -c z1.f90
f951: internal compiler error: Invalid expression in gfc_element_size.
0x796be9 gfc_report_diagnostic
        ../../gcc/fortran/error.c:874
0x798757 gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1494
0x83c8f2 gfc_element_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.c:137
0x83c953 gfc_target_expr_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.c:166
0x83086b gfc_simplify_sizeof(gfc_expr*)
        ../../gcc/fortran/simplify.c:7608
0x7ac972 do_simplify
        ../../gcc/fortran/intrinsic.c:4641
0x7b7a7a gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:5034
0x80b71c resolve_unknown_f
        ../../gcc/fortran/resolve.c:2972
0x80b71c resolve_function
        ../../gcc/fortran/resolve.c:3329
0x80b71c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7166
0x79cac4 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3130
0x79f990 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3178
0x789f44 variable_decl
        ../../gcc/fortran/decl.c:3004
0x789f44 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6297
0x7f3df3 match_word
        ../../gcc/fortran/parse.c:67
0x7f3df3 decode_statement
        ../../gcc/fortran/parse.c:378
0x7f583a next_free
        ../../gcc/fortran/parse.c:1397
0x7f583a next_statement
        ../../gcc/fortran/parse.c:1629
0x7f7ca4 parse_spec
        ../../gcc/fortran/parse.c:3984
0x7fa2bc parse_progunit
        ../../gcc/fortran/parse.c:6179

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
@ 2021-11-24 17:59 ` kargl at gcc dot gnu.org
  2021-11-25  7:17 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-24 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Priority|P3                          |P4
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-11-24
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index d675f2c3aef..596dbb3715c 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -7588,7 +7592,7 @@ gfc_simplify_sizeof (gfc_expr *x)
   mpz_t array_size;
   size_t res_size;

-  if (x->ts.type == BT_CLASS || x->ts.deferred)
+  if (x->ts.type == BT_BOZ || x->ts.type == BT_CLASS || x->ts.deferred)
     return NULL;

   if (x->ts.type == BT_CHARACTER

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
  2021-11-24 17:59 ` [Bug fortran/103412] " kargl at gcc dot gnu.org
@ 2021-11-25  7:17 ` rguenth at gcc dot gnu.org
  2021-11-25  9:53 ` [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954 marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-25  7:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
  2021-11-24 17:59 ` [Bug fortran/103412] " kargl at gcc dot gnu.org
  2021-11-25  7:17 ` rguenth at gcc dot gnu.org
@ 2021-11-25  9:53 ` marxin at gcc dot gnu.org
  2021-11-25 15:54 ` kargl at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-25  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12 Regression] ICE:  |[10/11/12 Regression] ICE:
                   |Invalid expression in       |Invalid expression in
                   |gfc_element_size            |gfc_element_size since
                   |                            |r10-2083-g8dc63166e0b85954
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-2083-g8dc63166e0b85954.

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-25  9:53 ` [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954 marxin at gcc dot gnu.org
@ 2021-11-25 15:54 ` kargl at gcc dot gnu.org
  2021-12-17 21:07 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-25 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Martin Liška from comment #2)
> Started with r10-2083-g8dc63166e0b85954.

No, it did not start with this commit.
It was exposed by this commit.

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-11-25 15:54 ` kargl at gcc dot gnu.org
@ 2021-12-17 21:07 ` anlauf at gcc dot gnu.org
  2021-12-17 22:18 ` sgk at troutmask dot apl.washington.edu
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-17 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Alternative patch:

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 3934336df2e..625473c90d1 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5135,6 +5135,9 @@ gfc_check_sizeof (gfc_expr *arg)
       return false;
     }

+  if (illegal_boz_arg (arg))
+    return false;
+
   /* TYPE(*) is acceptable if and only if it uses an array descriptor.  */
   if (arg->ts.type == BT_ASSUMED
       && (arg->symtree->n.sym->as == NULL

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-12-17 21:07 ` anlauf at gcc dot gnu.org
@ 2021-12-17 22:18 ` sgk at troutmask dot apl.washington.edu
  2021-12-18 22:22 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-12-17 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Dec 17, 2021 at 09:07:44PM +0000, anlauf at gcc dot gnu.org wrote:
> 
> --- Comment #4 from anlauf at gcc dot gnu.org ---
> Alternative patch:
> 

Either patch fixes the problem and I'll offer
that they both fall under the "obvious" label.  
Pick one and commit.:wq

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-12-17 22:18 ` sgk at troutmask dot apl.washington.edu
@ 2021-12-18 22:22 ` cvs-commit at gcc dot gnu.org
  2021-12-18 22:30 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-18 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-6059-gfd74a2ee40456a1d1621e88738f8e57536194080
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sat Dec 18 23:21:35 2021 +0100

    Fortran: reject BOZ type argument to SIZEOF().

    gcc/fortran/ChangeLog:

            PR fortran/103412
            * check.c (gfc_check_sizeof): Reject BOZ type argument.

    gcc/testsuite/ChangeLog:

            PR fortran/103412
            * gfortran.dg/illegal_boz_arg_2.f90: New test.

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-12-18 22:22 ` cvs-commit at gcc dot gnu.org
@ 2021-12-18 22:30 ` anlauf at gcc dot gnu.org
  2021-12-19 20:05 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-18 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-12-18 22:30 ` anlauf at gcc dot gnu.org
@ 2021-12-19 20:05 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:10 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:11 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-19 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:4f9ad140c6c2ca51b591f44f7579cc3b81356291

commit r11-9402-g4f9ad140c6c2ca51b591f44f7579cc3b81356291
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sat Dec 18 23:21:35 2021 +0100

    Fortran: reject BOZ type argument to SIZEOF().

    gcc/fortran/ChangeLog:

            PR fortran/103412
            * check.c (gfc_check_sizeof): Reject BOZ type argument.

    gcc/testsuite/ChangeLog:

            PR fortran/103412
            * gfortran.dg/illegal_boz_arg_2.f90: New test.

    (cherry picked from commit fd74a2ee40456a1d1621e88738f8e57536194080)

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2021-12-19 20:05 ` cvs-commit at gcc dot gnu.org
@ 2021-12-19 20:10 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:11 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-19 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:7ba46cc7867e0f7fc4b28f70f407067cfdd78112

commit r10-10349-g7ba46cc7867e0f7fc4b28f70f407067cfdd78112
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sat Dec 18 23:21:35 2021 +0100

    Fortran: reject BOZ type argument to SIZEOF().

    gcc/fortran/ChangeLog:

            PR fortran/103412
            * check.c (gfc_check_sizeof): Reject BOZ type argument.

    gcc/testsuite/ChangeLog:

            PR fortran/103412
            * gfortran.dg/illegal_boz_arg_2.f90: New test.

    (cherry picked from commit fd74a2ee40456a1d1621e88738f8e57536194080)

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

* [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
  2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2021-12-19 20:10 ` cvs-commit at gcc dot gnu.org
@ 2021-12-19 20:11 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-19 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed.

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

end of thread, other threads:[~2021-12-19 20:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 17:45 [Bug fortran/103412] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
2021-11-24 17:59 ` [Bug fortran/103412] " kargl at gcc dot gnu.org
2021-11-25  7:17 ` rguenth at gcc dot gnu.org
2021-11-25  9:53 ` [Bug fortran/103412] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954 marxin at gcc dot gnu.org
2021-11-25 15:54 ` kargl at gcc dot gnu.org
2021-12-17 21:07 ` anlauf at gcc dot gnu.org
2021-12-17 22:18 ` sgk at troutmask dot apl.washington.edu
2021-12-18 22:22 ` cvs-commit at gcc dot gnu.org
2021-12-18 22:30 ` anlauf at gcc dot gnu.org
2021-12-19 20:05 ` cvs-commit at gcc dot gnu.org
2021-12-19 20:10 ` cvs-commit at gcc dot gnu.org
2021-12-19 20:11 ` anlauf 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).