public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54934] New: Invalid debug/ array bounds w/-fno-range-check and 32-bit target
@ 2012-10-15 13:23 jan.kratochvil at redhat dot com
2012-10-15 15:40 ` [Bug fortran/54934] " kargl at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-10-15 13:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
Bug #: 54934
Summary: Invalid debug/ array bounds w/-fno-range-check and
32-bit target
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jan.kratochvil@redhat.com
Target: i386-unknown-linux-gnu
Siddhesh implemented support for 64-bit array bounds:
[PATCH] Expand fortran array bounds sizes to LONGEST
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
+ dimension foo(4294967296:4294967297)
+ dimension bar(-4294967297:-4294967296)
This requires -fno-range-check for gfortran to compile it at all.
It works for x86_64 target but it produces wrong debug info for i386 target.
FAIL: gcc (GCC) 4.8.0 20121015 (experimental)
Is this a bug or not? Should GDB support 64-bit Fortran array bounds?
Should such bounds require -fno-range-check?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/54934] Invalid debug/ array bounds w/-fno-range-check and 32-bit target
2012-10-15 13:23 [Bug fortran/54934] New: Invalid debug/ array bounds w/-fno-range-check and 32-bit target jan.kratochvil at redhat dot com
@ 2012-10-15 15:40 ` kargl at gcc dot gnu.org
2012-10-15 18:42 ` jan.kratochvil at redhat dot com
2012-10-15 18:47 ` [Bug debug/54934] [fortran] Invalid >4GB array bounds with " jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-10-15 15:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org 2012-10-15 15:40:28 UTC ---
Jan,
It's a convoluted problem. In gfortran, to get
the maximum range of an integer type you need
to use [-huge(i)-1:huge(i)] where 'i' is of the
type of interest. This is a result of gfortran
seeing a number like -4294967297 as a unary minus
with an operand of 4294967297. 4294967297 without
a kind suffix is of default integer kind, which is
a 32-bit signed int, and 4294967297 is slightly
larger than huge(1) = 2147483647. Note, Fortran
does not have unsigned integers. If you don't
want to or cannot use the -fno-range-check option,
you can do
integer(8), parameter :: n = 2 * (huge(1_4) + 1_8) + 1
dimension foo(n-1:n)
dimension bar(-n-1:-n)
bar = 42
foo = bar
print *, n
stop
end
where I correctly initialize bar to some value; otherwise, the
code is invalid Fortran. You could also decorate the integers
with a integer kind suffix
dimension foo(4294967296_8:4294967297_8)
dimension bar(-4294967297_8:-4294967296_8)
bar = 42
foo=bar
stop
end
Here, the _8 tells gfortran to use a signed 64-bit int.
Both code snippets above compile on my x86_64-*-freebsd.
I don't know want happens on an i686 target.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/54934] Invalid debug/ array bounds w/-fno-range-check and 32-bit target
2012-10-15 13:23 [Bug fortran/54934] New: Invalid debug/ array bounds w/-fno-range-check and 32-bit target jan.kratochvil at redhat dot com
2012-10-15 15:40 ` [Bug fortran/54934] " kargl at gcc dot gnu.org
@ 2012-10-15 18:42 ` jan.kratochvil at redhat dot com
2012-10-15 18:47 ` [Bug debug/54934] [fortran] Invalid >4GB array bounds with " jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-10-15 18:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-10-15 18:41:59 UTC ---
Created attachment 28451
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28451
.f source for a reproducer
Submitting it as a PR as the testcase no longer requires -fno-range-check and
it produces valid debug/ output with -m64 but invalid with -m32.
gcc (GCC) 4.8.0 20121015 (experimental)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/54934] [fortran] Invalid >4GB array bounds with 32-bit target
2012-10-15 13:23 [Bug fortran/54934] New: Invalid debug/ array bounds w/-fno-range-check and 32-bit target jan.kratochvil at redhat dot com
2012-10-15 15:40 ` [Bug fortran/54934] " kargl at gcc dot gnu.org
2012-10-15 18:42 ` jan.kratochvil at redhat dot com
@ 2012-10-15 18:47 ` jan.kratochvil at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-10-15 18:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-10-15 18:47:05 UTC ---
Created attachment 28452
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28452
.S from reproducer for -m32 output fixed by hand
.S file is a fix-up by hand to make -m32 working:
#if 0
original - not working
#else
patched - working
#endif
Or for original GCC output:
-m64 (working) -> -m32 (not working)
<88> DW_AT_lower_bound : 0xfffffffeffffffff
<90> DW_AT_upper_bound : 0xffffffff00000000
->
<74> DW_AT_lower_bound : 0xffffffff
<78> DW_AT_upper_bound : 0
<b5> DW_AT_lower_bound : 0x100000000
<bd> DW_AT_upper_bound : 0x100000001
->
<96> DW_AT_lower_bound : 0
<97> DW_AT_upper_bound : 1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-15 18:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 13:23 [Bug fortran/54934] New: Invalid debug/ array bounds w/-fno-range-check and 32-bit target jan.kratochvil at redhat dot com
2012-10-15 15:40 ` [Bug fortran/54934] " kargl at gcc dot gnu.org
2012-10-15 18:42 ` jan.kratochvil at redhat dot com
2012-10-15 18:47 ` [Bug debug/54934] [fortran] Invalid >4GB array bounds with " jan.kratochvil at redhat dot com
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).