Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal entity-oriented declaration crashes compiler #14

Open
ppenzin opened this issue Apr 1, 2018 · 0 comments
Open

Illegal entity-oriented declaration crashes compiler #14

ppenzin opened this issue Apr 1, 2018 · 0 comments

Comments

@ppenzin
Copy link
Contributor

ppenzin commented Apr 1, 2018

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant