public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46205] New: Invalid FORALL fails to compile
@ 2010-10-27 23:37 jstottsj at gmail dot com
  2010-10-28  1:27 ` [Bug fortran/46205] " jvdelisle at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jstottsj at gmail dot com @ 2010-10-27 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Invalid FORALL fails to compile
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jstottsj@gmail.com


Created attachment 22187
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22187
A very short program that illustrates the problem.

Compiler information:
  Using built-in specs.
  COLLECT_GCC=gfortran
 
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin10.4.0/4.5.1/lto-wrapper
  Target: x86_64-apple-darwin10.4.0
  Configured with: ./configure --enable-languages=c,c++,fortran,lto
  Thread model: posix
  gcc version 4.5.1 (GCC) 

Error message displayed:
  bugtest.f90: In function ‘forallbug’:
  bugtest.f90:1:0: internal compiler error: Segmentation fault
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <http://gcc.gnu.org/bugs.html> for instructions.

Description:
  An illegal FORALL statement consistently causes the compiler to crash instead
of generating an error message.  To trigger it, pass a vector (of type logical)
as the mask of the FORALL instead of the required scalar logial.

The bug does not depend on the complier flags; "gfortran -c bugtest.f90" is
sufficient.

I've attached a simple program that demonstrates the problem.

-JS


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

* [Bug fortran/46205] Invalid FORALL fails to compile
  2010-10-27 23:37 [Bug fortran/46205] New: Invalid FORALL fails to compile jstottsj at gmail dot com
@ 2010-10-28  1:27 ` jvdelisle at gcc dot gnu.org
  2010-11-11 13:07 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2010-10-28  1:27 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.28 01:27:01
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-10-28 01:27:01 UTC ---
Confirmed. I don't get a segfault, but we should catch this in the matchers I
would think.

$ gfc bugtest.f90 
bugtest.f90: In function ‘forallbug’:
bugtest.f90:23:0: internal compiler error: Unexpected type in
truthvalue_conversion
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug fortran/46205] Invalid FORALL fails to compile
  2010-10-27 23:37 [Bug fortran/46205] New: Invalid FORALL fails to compile jstottsj at gmail dot com
  2010-10-28  1:27 ` [Bug fortran/46205] " jvdelisle at gcc dot gnu.org
@ 2010-11-11 13:07 ` burnus at gcc dot gnu.org
  2010-11-11 23:07 ` burnus at gcc dot gnu.org
  2010-11-11 23:08 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-11 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-11 13:07:03 UTC ---
Untested patch:

Index: resolve.c
===================================================================
--- resolve.c   (Revision 166598)
+++ resolve.c   (Arbeitskopie)
@@ -9098,8 +9098,9 @@ resolve_code (gfc_code *code, gfc_namesp
        case EXEC_FORALL:
          resolve_forall_iterators (code->ext.forall_iterator);

-         if (code->expr1 != NULL && code->expr1->ts.type != BT_LOGICAL)
-           gfc_error ("FORALL mask clause at %L requires a LOGICAL "
+         if (code->expr1 != NULL
+             && (code->expr1->ts.type != BT_LOGICAL || code->expr1->rank))
+           gfc_error ("FORALL mask clause at %L requires a scalar LOGICAL "
                       "expression", &code->expr1->where);
          break;


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

* [Bug fortran/46205] Invalid FORALL fails to compile
  2010-10-27 23:37 [Bug fortran/46205] New: Invalid FORALL fails to compile jstottsj at gmail dot com
  2010-10-28  1:27 ` [Bug fortran/46205] " jvdelisle at gcc dot gnu.org
  2010-11-11 13:07 ` burnus at gcc dot gnu.org
@ 2010-11-11 23:07 ` burnus at gcc dot gnu.org
  2010-11-11 23:08 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-11 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-11 23:07:28 UTC ---
Author: burnus
Date: Thu Nov 11 23:07:23 2010
New Revision: 166631

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166631
Log:
2010-11-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/46413
        * resolve.c (resolve_transfer): Reject I/O transfer of
        polymorphic type.

        PR fortran/46205
        * resolve.c (resolve_code): Reject nonscalar FORALL masks.

2010-11-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/46413
        * gfortran.dg/class_31.f90: New.

        PR fortran/46205
        * gfortran.dg/forall_14.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/class_31.f90
    trunk/gcc/testsuite/gfortran.dg/forall_14.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/46205] Invalid FORALL fails to compile
  2010-10-27 23:37 [Bug fortran/46205] New: Invalid FORALL fails to compile jstottsj at gmail dot com
                   ` (2 preceding siblings ...)
  2010-11-11 23:07 ` burnus at gcc dot gnu.org
@ 2010-11-11 23:08 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-11 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-11 23:08:28 UTC ---
FIXED on the trunk (4.6).

Thanks Jonathan for the report!


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

end of thread, other threads:[~2010-11-11 23:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 23:37 [Bug fortran/46205] New: Invalid FORALL fails to compile jstottsj at gmail dot com
2010-10-28  1:27 ` [Bug fortran/46205] " jvdelisle at gcc dot gnu.org
2010-11-11 13:07 ` burnus at gcc dot gnu.org
2010-11-11 23:07 ` burnus at gcc dot gnu.org
2010-11-11 23:08 ` burnus at gcc dot gnu.org

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