public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size
@ 2021-07-05 16:43 gscfq@t-online.de
  2021-07-05 17:59 ` [Bug fortran/101329] " kargl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-07-05 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101329
           Summary: 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: ---

Affects versions down to at least r5 :


$ cat z1.f90
program p
   use iso_c_binding
   print *, c_sizeof(null())
end


$ gfortran-12-20210704 -c z1.f90
f951: internal compiler error: Invalid expression in gfc_element_size.
0x6f7ee9 gfc_report_diagnostic
        ../../gcc/fortran/error.c:782
0x6f9a57 gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1402
0x799c12 gfc_element_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.c:137
0x799c73 gfc_target_expr_size(gfc_expr*, unsigned long*)
        ../../gcc/fortran/target-memory.c:166
0x78dc4b gfc_simplify_sizeof(gfc_expr*)
        ../../gcc/fortran/simplify.c:7550
0x70db3a do_simplify
        ../../gcc/fortran/intrinsic.c:4657
0x71858a gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:5050
0x7691b9 resolve_unknown_f
        ../../gcc/fortran/resolve.c:2926
0x7691b9 resolve_function
        ../../gcc/fortran/resolve.c:3270
0x7691b9 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7104
0x76f5f4 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7071
0x76f5f4 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11832
0x76df3f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10851
0x76e308 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11822
0x770c17 resolve_codes
        ../../gcc/fortran/resolve.c:17427
0x770cde gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17462
0x759224 resolve_all_program_units
        ../../gcc/fortran/parse.c:6403
0x759224 gfc_parse_file()
        ../../gcc/fortran/parse.c:6655
0x7a5c4f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
@ 2021-07-05 17:59 ` kargl at gcc dot gnu.org
  2021-11-17 21:35 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-05 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-05
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 27bf3a7eafe..98155ce9d4c 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5217,6 +5217,12 @@ is_c_interoperable (gfc_expr *expr, const char **msg,
bool c_loc, bool c_f_ptr)
 {
   *msg = NULL;

+  if (expr->expr_type == EXPR_NULL)
+    {
+      *msg = "NULL() is not interoperable";
+      return false;
+    }
+
   if (expr->ts.type == BT_CLASS)
     {
       *msg = "Expression is polymorphic";

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
  2021-07-05 17:59 ` [Bug fortran/101329] " kargl at gcc dot gnu.org
@ 2021-11-17 21:35 ` anlauf at gcc dot gnu.org
  2021-11-18 18:36 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-17 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Packaged: https://gcc.gnu.org/pipermail/fortran/2021-November/057029.html

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
  2021-07-05 17:59 ` [Bug fortran/101329] " kargl at gcc dot gnu.org
  2021-11-17 21:35 ` anlauf at gcc dot gnu.org
@ 2021-11-18 18:36 ` cvs-commit at gcc dot gnu.org
  2021-11-18 19:20 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-18 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:3535be6c6f440909798d1c78e862a657f7adaf63

commit r12-5384-g3535be6c6f440909798d1c78e862a657f7adaf63
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Nov 17 22:21:24 2021 +0100

    Fortran: NULL() is not interoperable

    gcc/fortran/ChangeLog:

            PR fortran/101329
            * check.c (is_c_interoperable): Reject NULL() as it is not
            interoperable.

    gcc/testsuite/ChangeLog:

            PR fortran/101329
            * gfortran.dg/pr101329.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-18 18:36 ` cvs-commit at gcc dot gnu.org
@ 2021-11-18 19:20 ` anlauf at gcc dot gnu.org
  2021-12-27 19:51 ` cvs-commit at gcc dot gnu.org
  2021-12-27 20:04 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-18 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed for gcc-12.  Closing.

Thanks for the report!

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-11-18 19:20 ` anlauf at gcc dot gnu.org
@ 2021-12-27 19:51 ` cvs-commit at gcc dot gnu.org
  2021-12-27 20:04 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-27 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:a25bfec3aacc34be624a620b00a72719ac03092f

commit r11-9417-ga25bfec3aacc34be624a620b00a72719ac03092f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Nov 17 22:21:24 2021 +0100

    Fortran: NULL() is not interoperable

    gcc/fortran/ChangeLog:

            PR fortran/101329
            * check.c (is_c_interoperable): Reject NULL() as it is not
            interoperable.

    gcc/testsuite/ChangeLog:

            PR fortran/101329
            * gfortran.dg/pr101329.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
    (cherry picked from commit 3535be6c6f440909798d1c78e862a657f7adaf63)

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

* [Bug fortran/101329] ICE: Invalid expression in gfc_element_size
  2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-12-27 19:51 ` cvs-commit at gcc dot gnu.org
@ 2021-12-27 20:04 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-27 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:93c066f568822680506811d0de9c57c8a7a4e5d2

commit r10-10361-g93c066f568822680506811d0de9c57c8a7a4e5d2
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Nov 17 22:21:24 2021 +0100

    Fortran: NULL() is not interoperable

    gcc/fortran/ChangeLog:

            PR fortran/101329
            * check.c (is_c_interoperable): Reject NULL() as it is not
            interoperable.

    gcc/testsuite/ChangeLog:

            PR fortran/101329
            * gfortran.dg/pr101329.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
    (cherry picked from commit 3535be6c6f440909798d1c78e862a657f7adaf63)

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 16:43 [Bug fortran/101329] New: ICE: Invalid expression in gfc_element_size gscfq@t-online.de
2021-07-05 17:59 ` [Bug fortran/101329] " kargl at gcc dot gnu.org
2021-11-17 21:35 ` anlauf at gcc dot gnu.org
2021-11-18 18:36 ` cvs-commit at gcc dot gnu.org
2021-11-18 19:20 ` anlauf at gcc dot gnu.org
2021-12-27 19:51 ` cvs-commit at gcc dot gnu.org
2021-12-27 20:04 ` 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).