public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36276] New: possible issue with opening fortran files?
@ 2008-05-20 10:16 jv244 at cam dot ac dot uk
2008-05-20 10:17 ` [Bug fortran/36276] " jv244 at cam dot ac dot uk
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-05-20 10:16 UTC (permalink / raw)
To: gcc-bugs
compiling the testcase file (derived from CP2K) as:
valgrind --tool=memcheck
/data03/vondele/gcc_trunk/build/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/f951
lapack.f -march=k8 -quiet -dumpbase lapack.F -auxbase lapack -ffree-form
-fpreprocessed -fintrinsic-modules-path
/data03/vondele/gcc_trunk/build/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/finclude
-o lapack.s
yields the following error with valgrind:
==1593== Invalid read of size 1
==1593== at 0xB51CD1: linemap_add (line-map.c:111)
==1593== by 0xB52040: linemap_line_start (line-map.c:227)
==1593== by 0x46F0CC: load_file (scanner.c:1872)
==1593== by 0x46F574: gfc_new_file (scanner.c:1912)
==1593== by 0x48630F: gfc_init (f95-lang.c:288)
==1593== by 0x7016E8: toplev_main (toplev.c:2041)
==1593== by 0x4C7F153: (below main) (in /lib64/libc-2.4.so)
==1593== Address 0x4F31628 is 0 bytes inside a block of size 47 free'd
==1593== at 0x4A2066B: free (vg_replace_malloc.c:233)
==1593== by 0x46ED61: preprocessor_line (scanner.c:1642)
==1593== by 0x46EE8C: load_file (scanner.c:1800)
==1593== by 0x46F574: gfc_new_file (scanner.c:1912)
==1593== by 0x48630F: gfc_init (f95-lang.c:288)
==1593== by 0x7016E8: toplev_main (toplev.c:2041)
==1593== by 0x4C7F153: (below main) (in /lib64/libc-2.4.so)
--
Summary: possible issue with opening fortran files?
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
@ 2008-05-20 10:17 ` jv244 at cam dot ac dot uk
2008-05-20 15:29 ` jv244 at cam dot ac dot uk
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-05-20 10:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jv244 at cam dot ac dot uk 2008-05-20 10:16 -------
Created an attachment (id=15656)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15656&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
2008-05-20 10:17 ` [Bug fortran/36276] " jv244 at cam dot ac dot uk
@ 2008-05-20 15:29 ` jv244 at cam dot ac dot uk
2008-05-22 20:00 ` [Bug fortran/36276] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-05-20 15:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jv244 at cam dot ac dot uk 2008-05-20 15:28 -------
Created an attachment (id=15657)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15657&action=view)
an 8 line testcase
valgrind --tool=memcheck
/data03/vondele/gcc_trunk/build/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/f951
bug.f
small testcase, contains nearly no fortran
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
2008-05-20 10:17 ` [Bug fortran/36276] " jv244 at cam dot ac dot uk
2008-05-20 15:29 ` jv244 at cam dot ac dot uk
@ 2008-05-22 20:00 ` pinskia at gcc dot gnu dot org
2008-05-28 22:10 ` rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-22 20:00 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Target Milestone|--- |4.3.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (2 preceding siblings ...)
2008-05-22 20:00 ` [Bug fortran/36276] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-05-28 22:10 ` rguenth at gcc dot gnu dot org
2008-05-29 12:41 ` burnus at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-28 22:10 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (3 preceding siblings ...)
2008-05-28 22:10 ` rguenth at gcc dot gnu dot org
@ 2008-05-29 12:41 ` burnus at gcc dot gnu dot org
2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-05-29 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2008-05-29 12:40 -------
Confirm.
==1593== Invalid read of size 1
==1593== at 0xB51CD1: linemap_add (line-map.c:111)
That is libcpp/line-map.c:111:
source_location start_location = set->highest_location + 1;
I quickly looked at the source code and in the debugger, but I could not find
the problem. I had to add more comment lines to the 8-line test case, otherwise
valgrind wouldn't diagnose the invalid read.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-05-29 12:40:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (4 preceding siblings ...)
2008-05-29 12:41 ` burnus at gcc dot gnu dot org
@ 2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
2008-06-14 16:48 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-06-06 15:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-06-06 14:59 -------
4.3.1 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.1 |4.3.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (5 preceding siblings ...)
2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
@ 2008-06-14 16:48 ` burnus at gcc dot gnu dot org
2008-06-14 17:00 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-14 16:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2008-06-14 16:48 -------
I diffed 4.2 and 4.3 and found that the following patch "fixes" the problem,
though I do not quite understand why and how to properly fix it.
--- scanner.c (revision 136782)
+++ scanner.c (working copy)
@@ -1645,8 +1645,6 @@ preprocessor_line (gfc_char_t *c)
add_file_change (NULL, line);
current_file = current_file->up;
- linemap_add (line_table, LC_RENAME, false, current_file->filename,
- current_file->line);
}
/* The name of the file can be a temporary file produced by
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (6 preceding siblings ...)
2008-06-14 16:48 ` burnus at gcc dot gnu dot org
@ 2008-06-14 17:00 ` burnus at gcc dot gnu dot org
2008-06-16 17:55 ` burnus at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-14 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from burnus at gcc dot gnu dot org 2008-06-14 17:00 -------
For completeness, the line was added by
r128676 | fxcoudert | 2007-09-23 01:48:02 +0200 (So, 23. Sep 2007) | 5 lines
PR fortran/33528
The invalid read happens for linemap_add's "to_file". Above the function there
is the note:
The text pointed to by TO_FILE must have a lifetime
at least as long as the final call to lookup_line ().
My feeling is that current_file->filename is freed too early.
FX, do you have an idea?
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (7 preceding siblings ...)
2008-06-14 17:00 ` burnus at gcc dot gnu dot org
@ 2008-06-16 17:55 ` burnus at gcc dot gnu dot org
2008-06-20 13:58 ` lauras at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-16 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from burnus at gcc dot gnu dot org 2008-06-16 17:54 -------
Better patch. I'm not sure whether we are ever freeing the memory, but I think
even if not, it is not a big problem.
Index: scanner.c
===================================================================
--- scanner.c (Revision 136838)
+++ scanner.c
@@ -1654,7 +1654,8 @@ preprocessor_line (gfc_char_t *c)
if (strcmp (current_file->filename, filename) != 0)
{
- gfc_free (current_file->filename);
+ /* The current_file->filename may not be freed here as it still needs to
+ be accessible by lookup_line. */
current_file->filename = gfc_getmem (strlen (filename) + 1);
strcpy (current_file->filename, filename);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3/4.4 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (8 preceding siblings ...)
2008-06-16 17:55 ` burnus at gcc dot gnu dot org
@ 2008-06-20 13:58 ` lauras at gcc dot gnu dot org
2008-06-21 10:03 ` [Bug fortran/36276] [4.3 " burnus at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: lauras at gcc dot gnu dot org @ 2008-06-20 13:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from lauras at gcc dot gnu dot org 2008-06-20 13:57 -------
Subject: Bug 36276
Author: lauras
Date: Fri Jun 20 13:57:00 2008
New Revision: 136989
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136989
Log:
2008-06-20 Laurynas Biveinis <laurynas.biveinis@gmail.com>
Tobias Burnus <burnus@net-b.de>
PR fortran/34908
PR fortran/36276
* scanner.c (preprocessor_line): do not call gfc_free for
current_file->filename if it differs from filename.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/scanner.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (9 preceding siblings ...)
2008-06-20 13:58 ` lauras at gcc dot gnu dot org
@ 2008-06-21 10:03 ` burnus at gcc dot gnu dot org
2008-06-21 15:31 ` lauras at gcc dot gnu dot org
2008-06-21 21:40 ` lauras at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-21 10:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from burnus at gcc dot gnu dot org 2008-06-21 10:02 -------
Fixed on the trunk, leave open for 4.3.x.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
Summary|[4.3/4.4 Regression] |[4.3 Regression] possible
|possible issue with opening |issue with opening fortran
|fortran files? |files?
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (10 preceding siblings ...)
2008-06-21 10:03 ` [Bug fortran/36276] [4.3 " burnus at gcc dot gnu dot org
@ 2008-06-21 15:31 ` lauras at gcc dot gnu dot org
2008-06-21 21:40 ` lauras at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: lauras at gcc dot gnu dot org @ 2008-06-21 15:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from lauras at gcc dot gnu dot org 2008-06-21 15:30 -------
Subject: Bug 36276
Author: lauras
Date: Sat Jun 21 15:29:44 2008
New Revision: 137001
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137001
Log:
2008-06-20 Laurynas Biveinis <laurynas.biveinis@gmail.com>
Tobias Burnus <burnus@net-b.de>
PR fortran/34908
PR fortran/36276
* scanner.c (preprocessor_line): do not call gfc_free for
current_file->filename if it differs from filename.
Modified:
branches/gcc-4_3-branch/gcc/fortran/ChangeLog
branches/gcc-4_3-branch/gcc/fortran/scanner.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/36276] [4.3 Regression] possible issue with opening fortran files?
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
` (11 preceding siblings ...)
2008-06-21 15:31 ` lauras at gcc dot gnu dot org
@ 2008-06-21 21:40 ` lauras at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: lauras at gcc dot gnu dot org @ 2008-06-21 21:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from lauras at gcc dot gnu dot org 2008-06-21 21:40 -------
Closing the bug as the fix has been commited to the 4.3 branch too
--
lauras at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36276
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-06-21 21:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-20 10:16 [Bug fortran/36276] New: possible issue with opening fortran files? jv244 at cam dot ac dot uk
2008-05-20 10:17 ` [Bug fortran/36276] " jv244 at cam dot ac dot uk
2008-05-20 15:29 ` jv244 at cam dot ac dot uk
2008-05-22 20:00 ` [Bug fortran/36276] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-05-28 22:10 ` rguenth at gcc dot gnu dot org
2008-05-29 12:41 ` burnus at gcc dot gnu dot org
2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
2008-06-14 16:48 ` burnus at gcc dot gnu dot org
2008-06-14 17:00 ` burnus at gcc dot gnu dot org
2008-06-16 17:55 ` burnus at gcc dot gnu dot org
2008-06-20 13:58 ` lauras at gcc dot gnu dot org
2008-06-21 10:03 ` [Bug fortran/36276] [4.3 " burnus at gcc dot gnu dot org
2008-06-21 15:31 ` lauras at gcc dot gnu dot org
2008-06-21 21:40 ` lauras at gcc dot gnu dot org
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).