Follow up to PR 45380; frontend-passes.c currently only works for scalars - cf.
PR 45380:
+ /* An expression of type EXPR_CONSTANT is only valid for scalars. */
+ /* TODO: A scalar constant may be acceptable in some cases (the scalarizer
+ handles them well). However, there are also cases that need a non-scalar
+ argument. For example the any intrinsic. See PR 45380. */
+ if (e->rank > 0)
+ return false;
For instance, for an array "a"
if (ANY ( a == a ))
can NOT be optimized to
if (ANY ( .true. ))
but only to either
if (ANY ( [ .true., .true. ... ] ))
with the proper shape or handling the transformational intrinsics as:
if (.true.)
The reason is that ANY expects an array - analogously for ALL, SUM, PRODUCT,
PARITY, NORM2, ...
--
Summary: Apply front-end pass also for arrays
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45396