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/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e
Date: Fri, 12 May 2023 19:41:44 +0000	[thread overview]
Message-ID: <bug-109788-4-DlMKKBjpch@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109788-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from anlauf at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #11)
> If you e.g. put breakpoint on the spot I changed and stopon the testcase
> with -Os when t == global_trees[TI_VOID_LIST_NODE] you can then see in
> e->callee the FUNCTION_TYPE with just 5 arguments.

I am not too experienced to debug this kind of stuff, but I guess I've seen
what happens.  I was then wondering if one of the dump files would show the
function decl, like we can see it for normal procedures, but did not succeed.

The following (partial) patch seems to fix the decl:

diff --git a/gcc/fortran/iresolve.cc b/gcc/fortran/iresolve.cc
index 7880aba63bb..615d3ec98d4 100644
--- a/gcc/fortran/iresolve.cc
+++ b/gcc/fortran/iresolve.cc
@@ -2664,6 +2664,10 @@ gfc_resolve_spread (gfc_expr *f, gfc_expr *source,
gfc_expr *dim,
        f->value.function.name = PREFIX ("spread");
     }

+  /* Take formal argument type from SOURCE so that a function decl with the
+     right number of arguments is generated (hidden character length).  */
+  f->value.function.isym->formal->ts = source->ts;
+
   if (dim && gfc_is_constant_expr (dim)
       && ncopies && gfc_is_constant_expr (ncopies) && source->shape[0])
     {

It would be interesting to see if you see issues with the following code:

program p
  character(3) :: a = 'abc'
  real         :: b = 42.0
  complex      :: c = (2.0,0.0)
  type t
     integer :: i
  end type t
  type(t)      :: d = t(3)
  associate (y => spread(a,1,2) // "d")
  end associate
  associate (x => spread(b,1,2))
  end associate
  associate (z => spread(c,1,2))
  end associate
  associate (w => spread(d,1,2))
  end associate
end program p

The library function _gfortran_spread_char_scalar should now have 6 arguments,
while the uses of _gfortran_spread_scalar have 4 arguments, which are in part
pointers to either intrinsic or user-defined types.  I do hope that does not
lead to new problems.

  parent reply	other threads:[~2023-05-12 19:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 12:17 [Bug tree-optimization/109788] New: [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int marxin at gcc dot gnu.org
2023-05-09 12:31 ` [Bug tree-optimization/109788] [14 Regression] gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int since r14-377-gc92b8be9b52b7e marxin at gcc dot gnu.org
2023-05-09 12:44 ` jakub at gcc dot gnu.org
2023-05-09 12:58 ` [Bug fortran/109788] " jakub at gcc dot gnu.org
2023-05-09 13:10 ` jakub at gcc dot gnu.org
2023-05-10  7:05 ` rguenth at gcc dot gnu.org
2023-05-10 11:21 ` cvs-commit at gcc dot gnu.org
2023-05-10 11:23 ` jakub at gcc dot gnu.org
2023-05-10 18:47 ` anlauf at gcc dot gnu.org
2023-05-10 18:53 ` jakub at gcc dot gnu.org
2023-05-10 18:55 ` jakub at gcc dot gnu.org
2023-05-10 21:40 ` anlauf at gcc dot gnu.org
2023-05-10 21:46 ` jakub at gcc dot gnu.org
2023-05-12 19:41 ` anlauf at gcc dot gnu.org [this message]
2023-05-17  8:44 ` jamborm at gcc dot gnu.org
2023-10-17 10:34 ` rguenth at gcc dot gnu.org
2024-05-07  7:40 ` [Bug fortran/109788] [14/15 " rguenth 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-109788-4-DlMKKBjpch@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).