Re: gcc auto-omit-frame-pointer vs msvc longjmp

2011-10-20 Thread jojelino

On 2011-10-20 AM 6:05, Bob Breuer wrote:


We probably have a difference in build or run environment.  I've
double-checked with another machine and can get the same crash in
longjmp when running the test executable on both WinXP and Win2k, but
not on Win7.  So it looks like Microsoft may have changed this "feature"
somewhere between WinXP and Win7.

YEES! It does crash in winxp.


The msvcrt implementation of longjmp (or at least the one I'm looking
at) does a ebp based access using the saved value of ebp.  Here's the
relevant disassembly of longjmp:

0x7801e6f3 in longjmpex () from C:\WINNT\system32\msvcrt.dll
(gdb) disas
Dump of assembler code for function longjmpex:
0x7801e6ef<+0>: mov0x4(%esp),%ebx
=>  0x7801e6f3<+4>: mov(%ebx),%ebp
...
0x7801e73d<+78>:call   0x7800bd5e
...
0x7800bd5e<+56>:push   %ebx
0x7800bd5f<+57>:push   %ecx
0x7800bd60<+58>:mov$0x7803dc64,%ebx
=>  0x7800bd65<+63>:mov0x8(%ebp),%ecx

It crashes on the access of 0x8(%ebp).  Those are the only 2 places
where this version of longjmp touches ebp.  Is it possible to force a
stackframe by just adding a suitable attribute to either the setjmp
function prototype, or the function which calls setjmp?

and we had relevant report in ruby.
http://redmine.ruby-lang.org/issues/5375

Kai, would you mind if i reopen this bug you rejected?
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49230



Bob





--
Regards.



Re: gcc auto-omit-frame-pointer vs msvc longjmp

2011-10-21 Thread jojelino

On 2011-10-21 AM 12:34, Kai Tietz wrote:

Hi,

For trunk-version I have a tentative patch for this issue.  On 4.6.x
and older branches this doesn't work, as here we can't differenciate
that easy between ms- and sysv-abi.

But could somebody give this patch a try?

Regards,
Kai

ChangeLog

 * config/i386/i386.c (ix86_frame_pointer_required): Enforce use of
 frame-pointer for 32-bit ms-abi, if setjmp is used.

Index: i386.c
===
--- i386.c  (revision 180099)
+++ i386.c  (working copy)
@@ -8391,6 +8391,10 @@
if (SUBTARGET_FRAME_POINTER_REQUIRED)
  return true;

+  /* For older 32-bit runtimes setjmp requires valid frame-pointer.  */
+  if (TARGET_32BIT_MS_ABI&&  cfun->calls_setjmp)
+return true;
+
/* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER
   turns off the frame pointer by default.  Turn it back on now if
   we've not got a leaf function.  */



I tried this. it seems that problem is fixed. please apply this to 
trunk. although this workaround would not be needed anymore if mingw 
runtime provide longjmp which doesn't use _NLG_Notify.

--
Regards.



Re: Problem running the libgomp testsuite

2012-08-22 Thread jojelino

On 2012-08-20 AM 6:44, Jiří Paleček wrote:

Hello,

I tried to run "make check-c++" from the top directory of the source
code. During the run, all of the libgomp tests run by it failed. From
the log file, you can see that the gcc from the system (rather than the
gcc currently built) was run:

Executing on host: gcc
-B/mnt/extras/src/gcc2/i686-pc-linux-gnu/libgomp/ -B/mnt/extras/src ...
...
gcc: error: unrecognized command line option '-fno-diagnostics-show-caret'

Other tests (like libstdc++) correctly use the currently built gcc:

Executing on host: /mnt/extras/src/gcc2/host-i686-pc-linux-gnu/gcc/g++
-shared-libgcc ...
^^^

Any ideas how this could be fixed?

Regards
 Jiri Palecek

You need to modify Makefile to export CC,CXX variables so that dejagnu 
can execute built compiler.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51498 has similar workaround.
--
Regards.