public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54633] New: Issues with MINLOC/MINVAL (MAXLOC/MAXVAL)
@ 2012-09-20  8:30 burnus at gcc dot gnu.org
  2012-09-20  9:01 ` [Bug fortran/54633] ICEs and reject valid with MINLOC/MINVAL (MAXLOC/MAXVAL) due to lacking compile-time simplification burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-09-20  8:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54633

             Bug #: 54633
           Summary: Issues with MINLOC/MINVAL (MAXLOC/MAXVAL)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic, ice-on-valid-code, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Related to 54613, reported by James in the thread "Implicit" use of
assignment(=)"
at
https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/5eAz5ns6AG0

Namely:
https://groups.google.com/d/msg/comp.lang.fortran/5eAz5ns6AG0/G1uydcaGivkJ


ISSUES:

a) Wrong-code for minval4.f90?

With gfortran 4.3, it gets rejected with:

         integer x(minval((/1/)))
                                1
  Error: automatic object 'x' at (1) cannot have the SAVE attribute

interestingly, NAG f95 accepts it unless I use explicitly "save :: x", then it
rejects it with:
  Error: minval4.f90, line 7: Static array X cannot have variable bounds

Thus, I am bit lost whether it is valid or not.


b) ICE with minloc/minval (minval2.f90, minloc2.f90):

   integer x(sum(minloc((/1/))))
respectively:
   integer x(minval((/1/),mask=(/.TRUE./)))

in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5621

That's  gcc_assert (!TREE_STATIC (decl));  and decl is the var_decl "x".

The problem is that minloc/minval is not simplified to a constant. Other
compilers do compile-time evaluate this.

(Or they don't? Cf. (a).)


c) minval3.f90: This program compiles in gfortran with -std=f95 but other
compilers reject it with:
   MINVAL function is not permitted in an initialization expression

   integer, parameter :: m = minval((/1/))

I don't see ad hoc why the other compilers do accept in in (b) but not in (c).


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

end of thread, other threads:[~2013-07-27 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-20  8:30 [Bug fortran/54633] New: Issues with MINLOC/MINVAL (MAXLOC/MAXVAL) burnus at gcc dot gnu.org
2012-09-20  9:01 ` [Bug fortran/54633] ICEs and reject valid with MINLOC/MINVAL (MAXLOC/MAXVAL) due to lacking compile-time simplification burnus at gcc dot gnu.org
2012-09-20  9:22 ` burnus at gcc dot gnu.org
2013-07-27 16:54 ` dominiq at lps dot ens.fr

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).