[#44036] [ruby-trunk - Feature #6242][Open] Ruby should support lists — "shugo (Shugo Maeda)" <redmine@...>

20 messages 2012/04/01

[#44084] [ruby-trunk - Bug #6246][Open] 1.9.3-p125 intermittent segfault — "jshow (Jodi Showers)" <jodi@...>

22 messages 2012/04/02

[#44156] [ruby-trunk - Feature #6265][Open] Remove 'useless' 'concatenation' syntax — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

45 messages 2012/04/06

[#44163] [ruby-trunk - Bug #6266][Open] encoding related exception with recent integrated psych — "jonforums (Jon Forums)" <redmine@...>

10 messages 2012/04/06

[#44303] [ruby-trunk - Feature #6284][Open] Add composition for procs — "pabloh (Pablo Herrero)" <pablodherrero@...>

57 messages 2012/04/12

[#44349] [ruby-trunk - Feature #6293][Open] new queue / blocking queues — "tenderlovemaking (Aaron Patterson)" <aaron@...>

10 messages 2012/04/13

[#44402] [ruby-trunk - Feature #6308][Open] Eliminate delegation from WeakRef — "headius (Charles Nutter)" <headius@...>

20 messages 2012/04/17

[#44403] [ruby-trunk - Feature #6309][Open] Add a reference queue for weak references — "headius (Charles Nutter)" <headius@...>

15 messages 2012/04/17

[#44533] [ruby-trunk - Bug #6341][Open] SIGSEGV: Thread.new { fork { GC.start } }.join — "rudolf (r stu3)" <redmine@...>

24 messages 2012/04/22

[#44630] [ruby-trunk - Feature #6361][Open] Bitwise string operations — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>

31 messages 2012/04/26

[#44648] [ruby-trunk - Feature #6367][Open] #same? for Enumerable — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

16 messages 2012/04/26

[#44704] [ruby-trunk - Feature #6373][Open] public #self — "trans (Thomas Sawyer)" <transfire@...>

61 messages 2012/04/27

[#44748] [ruby-trunk - Feature #6376][Open] Feature lookup and checking if feature is loaded — "trans (Thomas Sawyer)" <transfire@...>

13 messages 2012/04/28

[ruby-core:44541] [ruby-trunk - Bug #6333] Ruby 1.9.3 (P0, P125,P194) Segmentation fault when compiled with GCC 4.7.0

From: "phasis68 (Heesob Park)" <phasis@...>
Date: 2012-04-23 08:02:46 UTC
List: ruby-core #44541
Issue #6333 has been updated by phasis68 (Heesob Park).


I can reproduce this issue on mingw gcc 4.7.0.

The point of segmentation fault is #902 of win32.c.
    return strcmp(key, *(const char *const *)elem);

And I found the main reason is invalid szInternalCmds array initialization on GCC 4.7.0.

I am not sure this is a bug of GCC 4.7.0, but GCC 4.7.0 cannot handle array initialization of string constant with point arithmetic properly.

Consider the following code:

#include <stdio.h>
int main() {
static const char *const aa[] = {"foo"+1};
printf("aa[0] = %s\n",aa[0]);
return 0;
}

I works fine on GCC 4.5.2 and 4.6.1
C:\work>gcc --version
gcc (tdm-1) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\work>gcc a.c -oa.exe

C:\work>a
aa[0] = oo


C:\work>gcc --version
gcc (tdm-1) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\work>gcc a.c -oa.exe

C:\work>a
aa[0] = oo

On GCC 4.7.0, it fails with segmentation fault.

C:\work>gcc --version
gcc (GCC) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\work>gcc a.c -oa.exe

C:\work>a

(error dialog)


----------------------------------------
Bug #6333: Ruby 1.9.3 (P0, P125,P194) Segmentation fault when compiled with GCC 4.7.0
https://bugs.ruby-lang.org/issues/6333#change-26091

Author: raylinn@gmail.com (ray linn)
Status: Assigned
Priority: Normal
Assignee: luislavena (Luis Lavena)
Category: 
Target version: 
ruby -v: ruby 1.9.3p194 (2012-04-20) [x64-mingw32]


Compiled Ruby 1.9.3 with GCC 4.7.0 (MinGW64) , when miniruby.exe execute ./win32/mkexports.rb, Segmentation fault occurs, the error message is as following:

        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -Ofast -I/usr/local/include
        XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hi
dden -DRUBY_EXPORT
        CPPFLAGS = -I/usr/local/icnlude -Ofast   -I. -I.ext/include/x64-mingw32
-I./include -I.
        DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-i
mplib=libx64-msvcrt-ruby191.dll.a x64-msvcrt-ruby191.def
        SOLIBS = x64-msvcrt-ruby191.res.o -lshell32 -lws2_32 -limagehlp
generating x64-msvcrt-ruby191.def
./win32/mkexports.rb:143: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20) [x64-mingw32]

-- Control frame information -----------------------------------------------
c:td p:---- s:td b:td l:td d:td CFUNC  :foreach
c:td p:td s:td b:td l:td d:td METHOD ./win32/mkexports.rb:143
c:td p:td s:td b:td l:td d:td METHOD ./win32/mkexports.rb:85
c:td p:td s:td b:td l:tx d:tx METHOD ./win32/mkexports.rb:150
c:td p:td s:td b:td l:td d:td METHOD ./win32/mkexports.rb:159
c:td p:td s:td b:td l:tx d:tx METHOD ./win32/mkexports.rb:40
c:td p:---- s:td b:td l:td d:td FINISH
c:td p:---- s:td b:td l:td d:td CFUNC  :new
c:td p:td s:td b:td l:td d:td METHOD ./win32/mkexports.rb:21
c:td p:td s:td b:td l:td d:td METHOD ./win32/mkexports.rb:25
c:td p:td s:td b:td l:tx d:td BLOCK  ./win32/mkexports.rb:166
c:td p:---- s:td b:td l:td d:td FINISH
c:td p:td s:td b:td l:tx d:tx TOP

-- Ruby level backtrace information ----------------------------------------
./win32/mkexports.rb:166:in `block in <main>'
./win32/mkexports.rb:25:in `extract'
./win32/mkexports.rb:21:in `create'
./win32/mkexports.rb:21:in `new'
./win32/mkexports.rb:40:in `initialize'
./win32/mkexports.rb:159:in `each_export'
./win32/mkexports.rb:150:in `each_export'
./win32/mkexports.rb:85:in `objdump'
./win32/mkexports.rb:143:in `each_line'
./win32/mkexports.rb:143:in `foreach'

-- C level backtrace information -------------------------------------------
C:\windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0xa) [0x0000000077B3135A]
C:\windows\system32\KERNELBASE.dll(WaitForSingleObjectEx+0x9c) [0x000007FEFE0310
DC]
 [0x000000000056A574]
 [0x000000000043FAEB]
 [0x0000000000440996]
 [0x00000000004F7BA4]
 [0x0000000000587275]
C:\windows\SYSTEM32\ntdll.dll(_C_specific_handler+0x9c) [0x0000000077AF85A8]
C:\windows\SYSTEM32\ntdll.dll(RtlDecodePointer+0xbd) [0x0000000077B09D0D]
C:\windows\SYSTEM32\ntdll.dll(RtlUnwindEx+0xbbf) [0x0000000077AF91AF]
C:\windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x0000000077B3127
8]
C:\windows\system32\msvcrt.dll(strcmp+0x43) [0x000007FEFE905963]
C:\windows\system32\msvcrt.dll(bsearch+0x89) [0x000007FEFE8F47D9]
 [0x000000000057E52B]
 [0x0000000000477E3D]
 [0x0000000000478401]
 [0x0000000000478673]
 [0x0000000000478A55]
 [0x0000000000478F43]
 [0x0000000000565ACC]
 [0x000000000055DA6A]
 [0x0000000000560B05]
 [0x0000000000561CDE]
 [0x0000000000562EEA]
 [0x0000000000496CF4]
 [0x0000000000565ACC]
 [0x000000000055DA6A]
 [0x0000000000560B05]
 [0x0000000000561827]
 [0x000000000044D5A0]
 [0x00000000004470CE]
 [0x0000000000447188]
 [0x0000000000447557]
 [0x000000000044794B]
 [0x000000000058B6B7]
 [0x00000000004013C9]
 [0x00000000004014E8]
C:\windows\system32\kernel32.dll(BaseThreadInitThunk+0xd) [0x000000007788652D]

-- Other runtime information -----------------------------------------------

* Loaded script: ./win32/mkexports.rb

* Loaded features:

    0 enumerator.so
    1 C:/msys/1.0/home/beta/ruby-1.9.3-p194/rbconfig.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
make: *** [x64-msvcrt-ruby191.def] Error 3

just make clean, and roll back the GCC to 4.6.3, recompile (just type make, no reconfiguration), then everything is ok.

change Ofast to O2, issue is still, and try P0, P125, P194, issue is the same.


-- 
http://bugs.ruby-lang.org/

In This Thread