[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 --- Comment #6 from Dominique d'Humieres --- The following test does not need -fdefault-integer-8, but only -m32 to give a wrong-code: module mykinds implicit none integer, parameter :: ik1 = selected_int_kind (2) integer, parameter :: ik2 = selected_int_kind (4) ! integer, parameter :: ik = selected_int_kind (8) integer, parameter :: ik = selected_int_kind (12) integer, parameter :: dp = selected_real_kind (15,300) end module mykinds module spec_xpr use mykinds implicit none integer(ik2) c_size contains pure function tricky (str,ugly) character(*), intent(in) :: str integer(ik1) :: ia_ik1(len(str)) interface yoagly pure function ugly(n) use mykinds implicit none integer(ik), intent(in) :: n complex(dp) :: ugly(3*n+2) end function ugly end interface yoagly logical(ik) :: la(size (yoagly (size (ia_ik1, kind=ik integer(ik) :: i character(tricky_helper ((/(.TRUE._ik, i=1, size (la))/)) + c_size) :: tricky tricky = transfer (yoagly (1_ik), tricky) end function tricky pure function tricky_helper (lb) logical(ik), intent(in) :: lb(:) integer(ik) :: tricky_helper tricky_helper = 2 * size (lb) + 3 end function tricky_helper end module spec_xpr module xtra_fun implicit none contains pure function butt_ugly(n) use mykinds implicit none integer(ik), intent(in) :: n complex(dp) :: butt_ugly(3*n+2) real(dp) pi, sq2 pi = 4 * atan (1.0_dp) sq2 = sqrt (2.0_dp) butt_ugly = cmplx (pi, sq2, dp) end function butt_ugly end module xtra_fun program spec_test use mykinds use spec_xpr use xtra_fun implicit none character(54) :: chr c_size = 5 if (tricky ('Help me', butt_ugly) .ne. transfer (butt_ugly (1_ik), chr)) call abort () end program spec_test
[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 --- Comment #5 from Dominique d'Humieres --- The following test (reduced from gfortran.dg/pr46588.f90) function aufun(pm) character(len = *) pm character(len = *) aufun print *, ">", pm, "<" aufun = 'Oh' // trim(pm) end function aufun program ds implicit none character(len = 4) :: ins = ' no!' character(len = 20) st, aufun logical(4) :: tst print *, ">", ins, "<" st = aufun(ins) print *, ">", st, "<" end gives > no!< Program received signal SIGSEGV: Segmentation fault - invalid memory reference. at run time when compiled with -m32 -fdefault-integer-8. I don't see any difference when comparing the outputs of -fdump-tree-original with -m32 or -m32 -fdefault-integer-8, but I see the following difference in the assembly files --- pr46588_db.s2018-03-05 12:50:58.0 +0100 +++ pr46588_db_m32.s2018-03-05 12:50:41.0 +0100 @@ -3,8 +3,7 @@ # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 # options passed: pr46588_db.f90 -fPIC -m32 -mmacosx-version-min=10.13.0 -# -mtune=corei7 -march=corei7 -fdefault-integer-8 -fdump-tree-original -# -fverbose-asm +# -mtune=corei7 -march=corei7 -fdump-tree-original -fverbose-asm # -fintrinsic-modules-path /opt/gcc/gcc8w/lib/gcc/x86_64-apple-darwin17.4.0/8.0.1/i386/finclude # options enabled: -Wnonportable-cfstrings -fPIC # -faggressive-loop-optimizations -fasynchronous-unwind-tables @@ -255,16 +254,14 @@ L2$pb: call__gfortran_st_write_done# addl$16, %esp #, # pr46588_db.f90:14:st = aufun(ins) - subl$12, %esp #, pushl $4 # leal_ins.3702-L2$pb(%ebx), %eax #, tmp97 pushl %eax# tmp97 - pushl $0 # pushl $20 # leal-48(%ebp), %eax #, tmp98 pushl %eax# tmp98 call_aufun_ # - addl$32, %esp #, + addl$16, %esp #, movl-48(%ebp), %eax # MEM[(c_char * {ref-all})], tmp99 movl%eax, -28(%ebp) # tmp99, MEM[(c_char * {ref-all})] movl-44(%ebp), %eax # MEM[(c_char * {ref-all})], tmp100
[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 --- Comment #4 from Thomas Koenig --- On a big-endian system (gcc110), there are segfaults. Looking into char_reshape_1.f90 yields Breakpoint 1, _gfortran_reshape_char (ret=0xfffef130, ret_length=4294897968, source=0x0, shape=0x9, pad=0xfffef1d8, order=0xfffef1b4, source_length=4294898064, pad_length=4294898028) at ../../../../trunk/libgfortran/intrinsics/reshape_generic.c:381 Looking at the tree dump gives something very strange: struct array01_unknown * D.2133; [...] D.2133 = typedef integer(kind=4) [3]; and then _gfortran_reshape_char (, 9, D.2133, D.2145, D.2147, D.2153, 9, 9); (wrong prototype, gdb is apparently showing the function in the tail call). So it seems that the stirng length constant simply has the wrong length, it occupies eight bytes where it should occupy four. Janne?
[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 --- Comment #3 from Thomas Koenig --- This has to be some issue with the charlen - possibly a default integer being used in the wrong place after r256322. I don't usually build 32-bit-capable compilers on my home system (too slow), let's see if I can get something built on the compile farm.
[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 Dominique d'Humieres changed: What|Removed |Added Blocks||32770 --- Comment #2 from Dominique d'Humieres --- s/comment 1/comment 0/ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32770 [Bug 32770] [Meta-bug] -fdefault-integer-8 issues
[Bug fortran/84615] [8 Regression] Executable Segfault for tests compiled with -fdefault-integer-8 and -m32
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84615 Dominique d'Humieres changed: What|Removed |Added Priority|P3 |P4 Status|UNCONFIRMED |NEW Known to work||7.3.0 Keywords||wrong-code Last reconfirmed||2018-02-28 CC||jb at gcc dot gnu.org, ||tkoenig at gcc dot gnu.org Ever confirmed|0 |1 Target Milestone|--- |8.0 Known to fail||8.0 --- Comment #1 from Dominique d'Humieres --- Note that the list given in comment 1 may be non-exhaustive and/or contain a few errors.