This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/33386] Fortran SELECT statement miscompiles
- From: "jpr at csc dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2007 10:42:53 -0000
- Subject: [Bug libfortran/33386] Fortran SELECT statement miscompiles
- References: <bug-33386-11807@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jpr at csc dot fi 2007-09-11 10:42 -------
(In reply to comment #1)
> I'll work on that, I've re-written CHARACTER SELECT recently. However, I can't
> reproduce this on x86_64-linux. Could you run "gfortran -fdump-tree-original
> a.f90" and post the a.f90.003t.original file produced?
>
Hi,
OK thanks. The .original file below is for this code:
PROGRAM test
CHARACTER :: c='c'
REAL :: x = 0
SELECT CASE(c)
CASE('a')
x = 1
CASE('b')
x = 2
END SELECT
PRINT*,x
END PROGRAM test
with the same valgrind warnings:
MAIN__ ()
{
static real4 x = 0.0;
static char c[1:1] = "c";
static int4 options.0[7] = {68, 127, 0, 0, 0, 1, 0};
_gfortran_set_options (7, (void *) &options.0);
{
int4 case_num.2;
static struct _jump_struct jumptable.1[2] = {{.string1=&"a"[1]{lb: 1 sz:
1}, .string1_len=1, .string2=&"a"[1]{lb: 1 sz: 1}, .string2_len=1, .target=0},
{.string1=&"b"[1]{lb: 1 sz: 1}, .string1_len=1, .string2=&"b"[1]{lb: 1 sz: 1},
.string2_len=1, .target=1}};
case_num.2 = _gfortran_select_string ((void *) &jumptable.1, 2, &c[1]{lb: 1
sz: 1}, 1);
switch (case_num.2)
{
case 0 ... 0:;
x = 1.0e+0;
goto L.1;
case 1 ... 1:;
x = 2.0e+0;
goto L.1;
}
L.1:;
}
{
struct __st_parameter_dt dt_parm.3;
dt_parm.3.common.filename = &"a.f90"[1]{lb: 1 sz: 1};
dt_parm.3.common.line = 11;
dt_parm.3.common.flags = 128;
dt_parm.3.common.unit = 6;
_gfortran_st_write (&dt_parm.3);
_gfortran_transfer_real (&dt_parm.3, &x, 4);
_gfortran_st_write_done (&dt_parm.3);
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33386