public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* ICE in gfc_new_symbol() due to overlong symbol name
@ 2018-08-25 20:51 Andrew Benson
  2018-09-04 16:43 ` [patch, fortan] PR87103 - [OOP] " Andrew Benson
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew Benson @ 2018-08-25 20:51 UTC (permalink / raw)
  To: fortran

I just opened PR for this: 87103

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87103

The following code causes an ICE with gfortan 9.0.0 (r263855):

module a
  type :: nameThatIsVeryLongButNotTooLongThatItShouldBeInvalid
  end type nameThatIsVeryLongButNotTooLongThatItShouldBeInvalid
contains
  subroutine b(self)
    class(nameThatIsVeryLongButNotTooLongThatItShouldBeInvalid), intent(in) :: 
self
    select type (self)
    class is (nameThatIsVeryLongButNotTooLongThatItShouldBeInvalid)
    end select
  end subroutine b
end module a

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-
linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools 
--enable-languages=c,c++,fortran --disable-multilib : (reconfigured) ../gcc-
trunk/configure --prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c+
+,fortran --disable-multilib : (reconfigured) ../gcc-trunk/configure --prefix=/
home/abenson/Galacticus/Tools --disable-multilib --enable-languages=c,c+
+,fortran,lto --no-create --no-recursion : (reconfigured) ../gcc-trunk/configure 
--prefix=/home/abenson/Galacticus/Tools --disable-multilib --enable-
languages=c,c++,fortran,lto --no-create --no-recursion : (reconfigured) ../gcc-
trunk/configure --prefix=/home/abenson/Galacticus/Tools --disable-multilib --
enable-languages=c,c++,fortran,lto --no-create --no-recursion
Thread model: posix
gcc version 9.0.0 20180825 (experimental) (GCC) 


$ gfortran -c tmp1.F90 -o tmp1.o
f951: internal compiler error: new_symbol(): Symbol name too long
0x7b9711 gfc_internal_error(char const*, ...)
        ../../gcc-trunk/gcc/fortran/error.c:1362
0x84a838 gfc_new_symbol(char const*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/symbol.c:3132
0x84ab97 gfc_get_sym_tree(char const*, gfc_namespace*, gfc_symtree**, bool)
        ../../gcc-trunk/gcc/fortran/symbol.c:3373
0x7e565d select_type_set_tmp
        ../../gcc-trunk/gcc/fortran/match.c:6114
0x7ee260 gfc_match_class_is()
        ../../gcc-trunk/gcc/fortran/match.c:6470
0x808c79 match_word
        ../../gcc-trunk/gcc/fortran/parse.c:65
0x80a4f1 decode_statement
        ../../gcc-trunk/gcc/fortran/parse.c:462
0x80d04c next_free
        ../../gcc-trunk/gcc/fortran/parse.c:1234
0x80d04c next_statement
        ../../gcc-trunk/gcc/fortran/parse.c:1466
0x810861 parse_select_type_block
        ../../gcc-trunk/gcc/fortran/parse.c:4236
0x810861 parse_executable
        ../../gcc-trunk/gcc/fortran/parse.c:5330
0x8118e6 parse_progunit
        ../../gcc-trunk/gcc/fortran/parse.c:5697
0x811bfc parse_contained
        ../../gcc-trunk/gcc/fortran/parse.c:5574
0x812a4c parse_module
        ../../gcc-trunk/gcc/fortran/parse.c:5944
0x812f75 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:6247
0x859d3f gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


The problem seems to be that gfc_new_symbol() is passed a name 
'__tmp_class_namethatisverylongbutnottoolongthatitshouldbeinvalid' in this 
case which exceeds GFC_MAX_SYMBOL_LEN=64. My understanding is that the code is 
valid since the symbol name itself, 
'namethatisverylongbutnottoolongthatitshouldbeinvalid', is less than 64 
characters. 

I'm not sure what the correct fix for this is - should the name length limit in 
gfc_new_symbol() just be increased by enough to allow the '__tmp_class_' 
prefix?

This appears to be a regression as the same code (with the same long-but-
legal) symbol names compiled under earlier versions of gfortran. I'll attempt 
to rollback to previous versions and see if I can identify where the change 
occurred.

-Andrew

-- 

* Andrew Benson: http://users.obs.carnegiescience.edu/abenson/contact.html

* Galacticus: https://bitbucket.org/abensonca/galacticus

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

end of thread, other threads:[~2020-01-30 17:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-25 20:51 ICE in gfc_new_symbol() due to overlong symbol name Andrew Benson
2018-09-04 16:43 ` [patch, fortan] PR87103 - [OOP] " Andrew Benson
2018-09-04 17:43   ` Bernhard Reutner-Fischer
     [not found]     ` <5aa0135b-1bdd-46de-e235-daed0a9a97e1@charter.net>
2018-09-05 10:35       ` Bernhard Reutner-Fischer
2018-09-05 14:24         ` Andrew Benson
2019-08-24 21:15         ` Andrew Benson
2019-08-28 22:48           ` Bernhard Reutner-Fischer
2019-08-30  8:22             ` Andrew Benson
2020-01-29 20:19             ` Andrew Benson
2020-01-30 16:28               ` Bernhard Reutner-Fischer
2020-01-30 17:50                 ` Andrew Benson
2020-01-27 20:57   ` [patch, fortran] PR93461 - Bogus "symbol is already defined" with long subroutine names in submodule Andrew Benson
2020-01-28  8:21     ` Tobias Burnus
2020-01-28 16:41       ` Andrew Benson
2020-01-28 17:50         ` Tobias Burnus
2020-01-28 18:14           ` Andrew Benson
2020-01-29  0:45           ` [patch, fortran, wwwdocs] " Andrew Benson
2020-01-29  9:08             ` Gerald Pfeifer
2020-01-29 10:57             ` Tobias Burnus
2020-01-29 16:37               ` Andrew Benson
2020-01-27 23:41   ` [patch, fortran] PR93473 - ICE on valid with long module + submodule names Andrew Benson
2020-01-28  8:28     ` Tobias Burnus
2020-01-28 16:41       ` Andrew Benson
2020-01-28 17:32         ` Tobias Burnus
2020-01-28 18:05           ` Andrew Benson

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