From: "knu (Akinori MUSHA)" <knu@...>
Date: 2012-11-08T15:12:12+09:00
Subject: [ruby-core:49086] [ruby-trunk - Bug #7307][Open] gcc -ansi vs. alloca (undefined reference to `alloca')


Issue #7307 has been reported by knu (Akinori MUSHA).

----------------------------------------
Bug #7307: gcc -ansi vs. alloca (undefined reference to `alloca')
https://bugs.ruby-lang.org/issues/7307

Author: knu (Akinori MUSHA)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-08) [x86_64-openbsd]


Ruby 2.0.0��������� CFLAGS ��� -ansi ������������������������������������������������
��������������������������������������� gcc ��� builtin alloca ���������������������
libc ��� alloca(3) ���������������������������������������OpenBSD���������������������
���NetBSD��� mips, powerpc, powerpc64, sparc, sparc64 ���������������������
������������������������������������������

linking miniruby
addr2line.o(.text+0x9e7): In function `follow_debuglink':
/home/knu/src/ruby-trunk-vanilla/addr2line.c:424: warning: strcpy() is almost always misused, please use strlcpy()
regerror.o(.text+0x499): In function `onig_vsnprintf_with_pattern':
/home/knu/src/ruby-trunk-vanilla/regerror.c:334: warning: strcat() is almost always misused, please use strlcat()
regerror.o(.text+0x55e):/home/knu/src/ruby-trunk-vanilla/regerror.c:197: warning: sprintf() is often misused, please use snprintf()
dmyencoding.o(.text+0x120e): In function `set_encoding_const':
/home/knu/src/ruby-trunk-vanilla/encoding.c:1535: undefined reference to `alloca'
bignum.o(.text+0xbfea): In function `rb_str_to_inum':
/home/knu/src/ruby-trunk-vanilla/bignum.c:791: undefined reference to `alloca'
object.o(.text+0x11c2): In function `rb_str_to_dbl':
/home/knu/src/ruby-trunk-vanilla/object.c:2565: undefined reference to `alloca'
parse.o(.text+0x1e24): In function `parser_yyerror':
/home/knu/src/ruby-trunk-vanilla/build.unknown.openbsd-amd64/parse.y:5221: undefined reference to `alloca'
parse.o(.text+0xb2c8): In function `parser_tokadd_string':
/home/knu/src/ruby-trunk-vanilla/build.unknown.openbsd-amd64/parse.y:6072: undefined reference to `alloca'
parse.o(.text+0xb2fb):/home/knu/src/ruby-trunk-vanilla/build.unknown.openbsd-amd64/parse.y:6085: more undefined references to `alloca' follow
collect2: ld returned 1 exit status
*** Error code 1

Stop in /home/knu/src/ruby-trunk-vanilla/build.unknown.openbsd-amd64 (line 180 of Makefile).


���������configure ������������������������������������������������������������������������

1. autoconf ��� AC_FUNC_ALLOCA ������������������������������������������������������
������������������ gcc ������������������ alloca ��� __builtin_alloca ������������
������������ configure ���������������

#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef _MSC_VER
#  include <malloc.h>
#  define alloca _alloca
# else
#  ifdef HAVE_ALLOCA_H
#   include <alloca.h>
#  else
#   ifdef _AIX
 #pragma alloca
#   else
#    ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca (size_t);
#    endif
#   endif
#  endif
# endif
#endif

2. gcc ��� -ansi ��������������� alloca ������������������������
���__builtin_alloca ������������������

3. ruby ������������������������������������������������������������ alloca ���������������
������������������1������������ alloca ��������������������������������������������� gc.c
��� #include "eval_intern.h" ������������������������

4. ��������������������������������������������������� -ansi ������������������������������������
addr2line.o, regerror.o, encoding.o ��������� alloca ������������������������
��������������� libc ��� alloca ������������������������������������������������


��������������� ruby/ruby.h ��� alloca ������������ gc.c ������������������������
gcc ������������������������������������������������������

������������������������������������������������ make test ���������������������

- OpenBSD/amd64 5.2-RELEASE (GCC 4.2.1) - libc has no alloca
- FreeBSD/amd64 9.1-PRERELEASE (GCC 4.2.1)
- FreeBSD/amd64 9.1-PRERELEASE (clang 3.1)
- Mac OS X 10.8.2 (Apple clang 4.1)

������������������������������������������


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