public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
@ 2022-06-15  8:24 gscfq@t-online.de
  2022-06-15 18:52 ` [Bug fortran/105986] " anlauf at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-06-15  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105986
           Summary: ICE in gfc_convert_mpz_to_signed, at
                    fortran/simplify.cc:193
           Product: gcc
           Version: 13.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
   integer :: i
   print *, [(btest(ibset(8_1,i), i), i=0,8)]
   print *, [(btest(ibset(8_2,i), i), i=0,16)]
   print *, [(btest(ibset(8_4,i), i), i=0,32)]
   print *, [(btest(ibset(8_8,i), i), i=0,64)]
   print *, [(btest(ibset(8_16,i), i), i=0,128)]
end


$ cat z2.f90
program p
   integer :: i
   print *, [(btest(ibset(8_1,i), i), i=-1,7)]
   print *, [(btest(ibset(8_2,i), i), i=-1,15)]
   print *, [(btest(ibset(8_4,i), i), i=-1,31)]
   print *, [(btest(ibset(8_8,i), i), i=-1,63)]
   print *, [(btest(ibset(8_16,i), i), i=-1,127)]
end


$ gfortran-13-20220612 -c z1.f90
f951: internal compiler error: in gfc_convert_mpz_to_signed, at
fortran/simplify.cc:193
0x788eb1 gfc_convert_mpz_to_signed(__mpz_struct*, int)
        ../../gcc/fortran/simplify.cc:193
0x78e41b gfc_simplify_ibset(gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.cc:3452
0x70e3c6 do_simplify
        ../../gcc/fortran/intrinsic.cc:4670
0x7191c8 gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.cc:4942
0x6ff0dc gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2228
0x6fed3b gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2224
0x6c59f1 expand_constructor
        ../../gcc/fortran/array.cc:1839
0x6c5c9e expand_expr
        ../../gcc/fortran/array.cc:1697
0x6c5c9e expand_iterator
        ../../gcc/fortran/array.cc:1767
0x6c5c9e expand_constructor
        ../../gcc/fortran/array.cc:1810
0x6c7dc7 gfc_array_size(gfc_expr*, __mpz_struct (*) [1])
        ../../gcc/fortran/array.cc:2677
0x76a75f expression_shape
        ../../gcc/fortran/resolve.cc:5519
0x76a75f gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.cc:5593
0x76c02f gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7223
0x77411c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7154
0x77411c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11966
0x772baf gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:10965
0x772f08 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11956
0x775c97 resolve_codes
        ../../gcc/fortran/resolve.cc:17609
0x775d5e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17644

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

* [Bug fortran/105986] ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
  2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
@ 2022-06-15 18:52 ` anlauf at gcc dot gnu.org
  2022-06-15 18:52 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-06-15 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
Created attachment 53147
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53147&action=edit
Tentative patch

We need to check the 'pos' argument in simplification.
Testing the attached patch.

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

* [Bug fortran/105986] ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
  2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
  2022-06-15 18:52 ` [Bug fortran/105986] " anlauf at gcc dot gnu.org
@ 2022-06-15 18:52 ` anlauf at gcc dot gnu.org
  2022-06-15 20:27 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-06-15 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-06-15

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

* [Bug fortran/105986] ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
  2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
  2022-06-15 18:52 ` [Bug fortran/105986] " anlauf at gcc dot gnu.org
  2022-06-15 18:52 ` anlauf at gcc dot gnu.org
@ 2022-06-15 20:27 ` anlauf at gcc dot gnu.org
  2022-06-18 16:57 ` cvs-commit at gcc dot gnu.org
  2022-06-18 17:00 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-06-15 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted patch: https://gcc.gnu.org/pipermail/fortran/2022-June/057932.html

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

* [Bug fortran/105986] ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
  2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-06-15 20:27 ` anlauf at gcc dot gnu.org
@ 2022-06-18 16:57 ` cvs-commit at gcc dot gnu.org
  2022-06-18 17:00 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-18 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:856a9b8fc2b457963898c539f0db92a1baa0bf27

commit r13-1165-g856a9b8fc2b457963898c539f0db92a1baa0bf27
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jun 15 22:20:09 2022 +0200

    Fortran: check POS and LEN arguments simplifying bit intrinsics [PR105986]

    gcc/fortran/ChangeLog:

            PR fortran/105986
            * simplify.cc (gfc_simplify_btest): Add check for POS argument.
            (gfc_simplify_ibclr): Add check for POS argument.
            (gfc_simplify_ibits): Add check for POS and LEN arguments.
            (gfc_simplify_ibset): Add check for POS argument.

    gcc/testsuite/ChangeLog:

            PR fortran/105986
            * gfortran.dg/check_bits_3.f90: New test.

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

* [Bug fortran/105986] ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193
  2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-06-18 16:57 ` cvs-commit at gcc dot gnu.org
@ 2022-06-18 17:00 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-06-18 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

Thanks for the report!

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

end of thread, other threads:[~2022-06-18 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  8:24 [Bug fortran/105986] New: ICE in gfc_convert_mpz_to_signed, at fortran/simplify.cc:193 gscfq@t-online.de
2022-06-15 18:52 ` [Bug fortran/105986] " anlauf at gcc dot gnu.org
2022-06-15 18:52 ` anlauf at gcc dot gnu.org
2022-06-15 20:27 ` anlauf at gcc dot gnu.org
2022-06-18 16:57 ` cvs-commit at gcc dot gnu.org
2022-06-18 17:00 ` 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).