Bug 88536 - [9 Regression] i686 testsuite errors for %re, %im, %len and %kind features
Summary: [9 Regression] i686 testsuite errors for %re, %im, %len and %kind features
Status: RESOLVED DUPLICATE of bug 87881
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-18 11:59 UTC by Manfred Schwarb
Modified: 2018-12-18 15:16 UTC (History)
1 user (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manfred Schwarb 2018-12-18 11:59:02 UTC
Since several weeks I get testsuite errors for the i686 target (x86_64 is OK)
which relate to the %re, %im, %len and %kind features:

gfortran.dg/inquiry_type_ref_1.f08
gfortran.dg/inquiry_type_ref_3.f90
gfortran.dg/pr87945_1.f90
gfortran.dg/pr87945_2.f90
gfortran.dg/pr87994_1.f90
gfortran.dg/pr87994_2.f90
gfortran.dg/pr87994_3.f90

Unfortunately, the error messages are not really helpful:
f951: internal compiler error: Segmentation fault
0x838c18c ???
        ../sysdeps/i386/elf/start.S:119
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.


I was not able to further track down these errors.
Related bug reports are PR40196, PR87945 and PR87994.
Comment 1 Richard Biener 2018-12-18 12:14:21 UTC
I don't see these on x86_64 when testing with -m32.  Can you paste your exact configuration (gfortran -v)?
Comment 2 Manfred Schwarb 2018-12-18 12:19:20 UTC
./gfortran -v output:
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-trunk-32bit/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk-32bit/bin/../libexec/gcc/i686-linux/9.0.0/lto-wrapper
Target: i686-linux
Configured with: ../gcc-trunk-source/gcc/configure --enable-languages=c,c++,fortran --enable-checking=yes,extra --disable-libstdcxx-pch --enable-libgomp --enable-lto --enable-gold --with-plugin-ld=gold --prefix=/usr/local/gcc-trunk-32bit i686-linux
Thread model: posix
gcc version 9.0.0 20181218 (experimental) [trunk revision 267225] (GCC) 

This build of the 32bit compiler is made in an OpenSuse 11.4 x86_64 environment using glibc 2.11.3
Comment 3 Manfred Schwarb 2018-12-18 12:45:39 UTC
BTW, the build logs (*README.txt) are here:
http://gfortran.meteodat.ch/download/i686/nightlies/
Comment 4 Jakub Jelinek 2018-12-18 13:18:20 UTC
I don't see these in my i686-linux bootstraps either (Fedora distro).
Can you run gdb on it?
gdb `gcc -print-prog-name=f951` -quiet pr87945_1.f90
run
bt
?
Comment 5 Dominique d'Humieres 2018-12-18 14:18:29 UTC
Duplicate of pr87881. Not really a duplicate.

*** This bug has been marked as a duplicate of bug 87881 ***
Comment 6 Jakub Jelinek 2018-12-18 15:00:41 UTC
Indeed:
==8241== Invalid read of size 8
==8241==    at 0x873E24: simplify_ref_chain(gfc_ref*, int, gfc_expr**) (expr.c:1943)
==8241==    by 0x8744C0: gfc_simplify_expr(gfc_expr*, int) (expr.c:2164)
==8241==    by 0x8F366B: gfc_match_varspec(gfc_expr*, int, bool, bool) (primary.c:2287)
==8241==    by 0x8F756B: match_variable(gfc_expr**, int, int) (primary.c:3971)
==8241==    by 0x8F75BC: gfc_match_variable(gfc_expr**, int) (primary.c:3986)
==8241==    by 0x84C5E6: var_element(gfc_data_variable*) (decl.c:280)
==8241==    by 0x84C794: top_var_list(gfc_data*) (decl.c:332)
==8241==    by 0x84CFD1: gfc_match_data() (decl.c:617)
==8241==    by 0x8E2361: match_word(char const*, match (*)(), locus*) (parse.c:65)
==8241==    by 0x8E360C: decode_statement() (parse.c:468)
==8241==    by 0x8E7A6B: next_free() (parse.c:1235)
==8241==    by 0x8E8028: next_statement() (parse.c:1467)
==8241==  Address 0x6351ba8 is 728 bytes inside a block of size 736 free'd
==8241==    at 0x4C2DD18: free (vg_replace_malloc.c:530)
==8241==    by 0x870ACB: gfc_free_ref_list(gfc_ref*) (expr.c:606)
==8241==    by 0x870869: free_expr0(gfc_expr*) (expr.c:505)
==8241==    by 0x870AF8: gfc_replace_expr(gfc_expr*, gfc_expr*) (expr.c:616)
==8241==    by 0x873DF7: simplify_ref_chain(gfc_ref*, int, gfc_expr**) (expr.c:1970)
==8241==    by 0x8744C0: gfc_simplify_expr(gfc_expr*, int) (expr.c:2164)
==8241==    by 0x8F366B: gfc_match_varspec(gfc_expr*, int, bool, bool) (primary.c:2287)
==8241==    by 0x8F756B: match_variable(gfc_expr**, int, int) (primary.c:3971)
==8241==    by 0x8F75BC: gfc_match_variable(gfc_expr**, int) (primary.c:3986)
==8241==    by 0x84C5E6: var_element(gfc_data_variable*) (decl.c:280)
==8241==    by 0x84C794: top_var_list(gfc_data*) (decl.c:332)
==8241==    by 0x84CFD1: gfc_match_data() (decl.c:617)
==8241==  Block was alloc'd at
==8241==    at 0x4C2EA1E: calloc (vg_replace_malloc.c:711)
==8241==    by 0x2149D20: xcalloc (xmalloc.c:162)
==8241==    by 0x8F288F: is_inquiry_ref(char const*, gfc_ref**) (primary.c:1964)
==8241==    by 0x8F3292: gfc_match_varspec(gfc_expr*, int, bool, bool) (primary.c:2199)
==8241==    by 0x8F756B: match_variable(gfc_expr**, int, int) (primary.c:3971)
==8241==    by 0x8F75BC: gfc_match_variable(gfc_expr**, int) (primary.c:3986)
==8241==    by 0x84C5E6: var_element(gfc_data_variable*) (decl.c:280)
==8241==    by 0x84C794: top_var_list(gfc_data*) (decl.c:332)
==8241==    by 0x84CFD1: gfc_match_data() (decl.c:617)
==8241==    by 0x8E2361: match_word(char const*, match (*)(), locus*) (parse.c:65)
==8241==    by 0x8E360C: decode_statement() (parse.c:468)
==8241==    by 0x8E7A6B: next_free() (parse.c:1235)
Comment 7 Manfred Schwarb 2018-12-18 15:16:51 UTC
Thanks Jakub for the debug hint, and thanks Dominique for finding the duplicate.
Indeed, my backtrace also points to simplify_ref_chain:

# gdb --quiet `/usr/local/gcc-trunk-32bit/bin/gcc -print-prog-name=f951`
Reading symbols from /usr/local/gcc-trunk-32bit/libexec/gcc/i686-linux/9.0.0/f951...done.
(gdb) run /tmp/gcc-trunk-source/gcc/gcc/testsuite/gfortran.dg/pr87945_1.f90
Starting program: /usr/local/gcc-trunk-32bit/libexec/gcc/i686-linux/9.0.0/f951 /tmp/gcc-trunk-source/gcc/gcc/testsuite/gfortran.dg/pr87945_1.f90
/tmp/gcc-trunk-source/gcc/gcc/testsuite/gfortran.dg/pr87945_1.f90:5:13:

    5 |    data a%len /1/       ! { dg-error "parameter cannot appear in" }
      |             1
Error: Inquiry parameter cannot appear in a data-stmt-object-list at (1)

Program received signal SIGSEGV, Segmentation fault.
0x083debd5 in simplify_ref_chain(gfc_ref*, int, gfc_expr**) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
414                   gcc_assert (lo < hi);
(gdb) bt
#0  0x083debd5 in simplify_ref_chain(gfc_ref*, int, gfc_expr**) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#1  0x083de5bc in gfc_simplify_expr(gfc_expr*, int) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#2  0x08435f2b in gfc_match_varspec(gfc_expr*, int, bool, bool) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#3  0x08436719 in match_variable(gfc_expr**, int, int) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#4  0x083c1fa7 in var_element(gfc_data_variable*) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#5  0x083c3e98 in gfc_match_data() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#6  0x08428b4a in match_word () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#7  0x0842a5ea in decode_statement() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#8  0x0842d0a5 in next_statement() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#9  0x0842e9ff in parse_spec(gfc_statement) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#10 0x08430eaa in parse_progunit(gfc_statement) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#11 0x08432153 in gfc_parse_file() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#12 0x08479649 in gfc_be_parse_file() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#13 0x0897ce7d in compile_file() () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#14 0x083a01cf in toplev::main(int, char**) () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414
#15 0x083a3c31 in main () at ../../../gcc-trunk-source/gcc/libgcc/unwind-dw2-fde-dip.c:414