public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* issue with gcc 4.x optimizations
@ 2006-07-05  8:14 Martin Quinson
  2006-07-05  9:11 ` Andrew Haley
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Quinson @ 2006-07-05  8:14 UTC (permalink / raw)
  To: gcc-help; +Cc: Martin Quinson, Arnaud Legrand

[-- Attachment #1: Type: text/plain, Size: 3185 bytes --]

Hello,

I come to you because I have an issue regarding gcc optimization in the 4.x
branch which really puzzles me. 

I have a rather big program here which compiles perfectly on a whole bunch
of architectures (x86, amd64, ppc, sparc, ...) with older versions (3.3,
3.4) with -O3 -fno-strict-aliasing. It even works with 2.9-aix51-020209 on
AIX ;) It also works with 4.0 and 4.1 with -O0 (tested only on x86).

But it fails as soon as I use -O1 on v4.x. It even fails with
   -O1 -fno-defer-pop -fno-guess-branch-probability -fno-cprop-registers
   -fno-loop-optimize -fno-if-conversion -fno-if-conversion2
   -fno-merge-constants -fno-tree-ccp -fno-tree-dce -fno-tree-dominator-opts
   -fno-tree-dse -fno-tree-ter -fno-tree-lrs -fno-tree-sra
   -fno-tree-copyrename -no-ftree-fre -fno-tree-ch -fno-delayed-branch
According to the documentation, this should be very close to -O0 since I
disable all the flags enabled by -O1. The difference should come from what
the documentation implies when stating: "Not all optimizations are
controlled directly by a flag. Only optimizations that have a flag are
listed". I guess that my problem comes from one of the not listed
optimizations.

The symptoms are a segfault near the end of the program with the following
valgrind backtrace:
==13387== Jump to the invalid address stated on the next line
==13387==    at 0x34938BFF: ???
==13387==    by 0x406602F: gras_process_exit (rl_process.c:23)
==13387==    by 0x40450EE: gras_exit (gras.c:74)
==13387==    by 0x804E216: main (datadesc_usage.c:662)
==13387==  Address 0x34938BFF is not stack'd, malloc'd or (recently) free'd
==13387==
==13387== Process terminating with default action of signal 11 (SIGSEGV)
==13387==  Access not within mapped region at address 0x34938BFF
==13387==    at 0x34938BFF: ???
==13387==    by 0x406602F: gras_process_exit (rl_process.c:23)
==13387==    by 0x40450EE: gras_exit (gras.c:74)
==13387==    by 0x804E216: main (datadesc_usage.c:662)
==13387==
==13387== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 21 from 2)

Here is the code of gras_process_exit():
void gras_process_exit() {
  gras_procdata_exit();
  free(_gras_procdata);
}
Line 23 of this file is the call to gras_procdata_exit(). As you can see,
there is no reason for this call to get unresolved by valgrind. Why "???" ?
And moreover, why 0x34938BFF? It seems a bit strange to me (too far from the
other addresses).



If someone wants to play with the code, it's available from our CVS here:
cvs -d :pserver:anonymous@scm.gforge.inria.fr:/cvsroot/simgrid co simgrid
but 20000 lines are ways too much for a proper bug repport, I guess. 

I write to this mailing list because I have no idea of where to look at. I
just wanted to check if someone already experienced something like that
before.


If someone can help me, that would be just wonderful. If not, I'm doomed to
3.x versions...

Thanks in advance,
Mt.

PS: please CC me as I'm not on the list yet.

-- 
Oh, I am a C programmer and I'm okay.
I muck with indices and structs all day.
And when it works, I shout hoo-ray.
Oh, I am a C programmer and I'm okay.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-07-06  8:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-05  8:14 issue with gcc 4.x optimizations Martin Quinson
2006-07-05  9:11 ` Andrew Haley
2006-07-05 16:36 ` Ian Lance Taylor
2006-07-05 23:37 ` Martin Quinson
2006-07-06  1:52   ` Martin Quinson
2006-07-06  8:47     ` Andrew Haley

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).