Summary: | Array BACK ignored in INDEX intrinsic when other args scalar | ||
---|---|---|---|
Product: | gcc | Reporter: | Dick Hendrickson <dick.hendrickson> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dick.hendrickson, fxcoudert, gcc-bugs, tkoenig |
Priority: | P3 | Keywords: | wrong-code |
Version: | 4.4.0 | ||
Target Milestone: | 4.4.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2008-04-16 18:16:05 |
Description
Dick Hendrickson
2008-04-14 21:46:43 UTC
I forgot to include the output C:\gfortran>gfortran fa1031.f C:\gfortran>a T F T F T F T F T F 1 1 1 1 1 1 1 1 1 1 4 1 4 1 4 1 4 1 4 1 4 Confirmed, not a regression. this looks promising: Index: gcc/gcc/fortran/simplify.c =================================================================== --- gcc/gcc/fortran/simplify.c (revision 134801) +++ gcc/gcc/fortran/simplify.c (working copy) @@ -1570,7 +1570,8 @@ int back, len, lensub; int i, j, k, count, index = 0, start; - if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT) + if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT + || b->expr_type != EXPR_CONSTANT) return NULL; if (b != NULL && b->value.logical != 0) Note the last line of patch is checking for b != NULL before using it. Probably want to do likewise for the added test condition above. close. here is a better patch. http://gcc.gnu.org/ml/fortran/2008-04/msg00278.html notice the 6 minutes between the above posts :) jerry was correct, it needed a NULL check. Patch committed, fixed on mainline. |