public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/107680] ICE in arith_power, at fortran/arith.cc:989 and :1006
Date: Tue, 15 Nov 2022 19:34:54 +0000	[thread overview]
Message-ID: <bug-107680-4-rhyzmpj5Ft@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107680-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to Mikael Morin from comment #3)
> I thought the call to gfc_type_convert_binary in eval_intrinsic was taking
> care of mismatching types, doesn't it?

It does, and then it doesn't do it sometimes...

For

  real, parameter :: x(*) = [real :: ([1])]   **  2.0

after adding breakpoints in gfc_type_convert_binary and arith_power,
I see correct types in the former (e->value.op.op2->ts.type = BT_REAL)
but incorrect types in the latter (op1->ts.type = BT_INTEGER).

It seems to be the ratatouille of parentheses, array constructors,
typespec, and arithmetic operation that is crucial to get this type
of error.

In 12-branch, I also see other bad things happening, which I believe have
partially been fixed by the series of patches for pr107000 and friends.
Try:

  print *, [integer :: ([3.0])] **  2.0

This gives

0.00000000

for all versions <= 12, and

9.00000000

for mainline.

Given these observations, I suspect that typespecs are not consistently
handled...  See also the previous discussions.

  parent reply	other threads:[~2022-11-15 19:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 17:26 [Bug fortran/107680] New: " gscfq@t-online.de
2022-11-14 18:23 ` [Bug fortran/107680] " anlauf at gcc dot gnu.org
2022-11-14 21:44 ` anlauf at gcc dot gnu.org
2022-11-15 10:18 ` mikael at gcc dot gnu.org
2022-11-15 19:34 ` anlauf at gcc dot gnu.org [this message]
2022-11-15 20:45 ` anlauf at gcc dot gnu.org
2022-11-16 20:17 ` cvs-commit at gcc dot gnu.org
2022-11-18 18:29 ` anlauf at gcc dot gnu.org
2022-11-28 22:29 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107680-4-rhyzmpj5Ft@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).