This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55214] Program fail to evaluate where clause
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 Nov 2012 14:56:56 +0000
- Subject: [Bug fortran/55214] Program fail to evaluate where clause
- Auto-submitted: auto-generated
- References: <bug-55214-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55214
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-11-05
CC| |burnus at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-05 14:56:56 UTC ---
Confirmed - and not a regression as it also fails with GCC 4.1.
>From the C-like dump file (use -fdump-tree-original to create it):
For WHERE (L), one has:
cond.3 = (logical(kind=1)) l[S.2 + -1];
temp.0[count.1] = cond.3;
Which is then used in WHERE (SQRT(X)>0):
cond.7 = __builtin_sqrtf (x[S.6 + -1]) > 0.0;
mask.8 = temp.0[count.5];
temp.4[count.5] = mask.8 && cond.7;
The proper way would be:
mask.8 = temp.0[count.5];
temp.4[count.5] = mask.8 ? __builtin_sqrtf (x[S.6 + -1]) > 0.0 : mask.8;
That is, the condition only gets evaluated if the outer mask is true.