Skip to content

Illegal entity-oriented declaration crashes compiler #14

Open
@ppenzin

Description

@ppenzin

In entity-oriented declarations, type should come before the attributes (opposite orders is a syntax error):

integer, intent(out) :: x

With user-defined type, using declaration in wrong order crashes the compiler:

$ cat type.f90
function r(a) 
  implicit none
  type point
    real :: x, y
  end type
  ! Should have been 'type(point), intent(in) :: a'
  intent(in), type(point) :: a
  real :: r
  r = sqrt(a%x**2 + a%y**2)
end function
$ fort -fsyntax-only type.f90 
type.f90:6:3: error: unsupported statement
  intent(in), type(point) :: a
  ^
type.f90:1:12: error: the argument 'a' requires a type specifier
function r(a) 
           ^
Assertion failed: (!isNull() && "Cannot retrieve a NULL type pointer"), function getCommonPtr, file /home/petr/devel/fort/include/fort/AST/Type.h, line 305.
#0 0x0000000003deea3d llvm::sys::PrintStackTrace(llvm::raw_ostream&) /usr/home/petr/src/llvm/trunk/llvm/lib/Support/Unix/Signals.inc:398:13
#1 0x0000000003deeef9 PrintStackTraceSignalHandler(void*) /usr/home/petr/src/llvm/trunk/llvm/lib/Support/Unix/Signals.inc:462:1
#2 0x0000000003debaa7 llvm::sys::RunSignalHandlers() /usr/home/petr/src/llvm/trunk/llvm/lib/Support/Signals.cpp:0:5
#3 0x0000000003def22a SignalHandler(int) /usr/home/petr/src/llvm/trunk/llvm/lib/Support/Unix/Signals.inc:252:1
#4 0x000000080547e926 (/lib/libthr.so.3+0xe926)
#5 0x000000080547decf (/lib/libthr.so.3+0xdecf)
Stack dump:
0.	Program arguments: bin/fort -fsyntax-only type.f90 
1.	type.f90:8:13: error: current parser token '%'
  r = sqrt(a%x**2 + a%y**2)
            ^
Abort trap (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions