Issue #15519 has been reported by vo.x (Vit Ondruch).

----------------------------------------
Bug #15519: addr2line compile error on RHEL7
https://bugs.ruby-lang.org/issues/15519

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: REQUIRED
----------------------------------------
I am observing following compilation:

~~~
gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN   -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/11.0.0  -o dln.o -c dln.c
addr2line.c: In function 'di_find_abbrev':
addr2line.c:1210:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (uint64_t n = uleb128(&p); abbrev_number != n; n = uleb128(&p)) {
     ^
addr2line.c:1210:5: note: use option -std=c99 or -std=gnu99 to compile your code
addr2line.c: In function 'debug_info_read':
addr2line.c:1558:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for (int i=offset; i < num_traces; i++) {
         ^
make: *** [addr2line.o] Error 1
make: *** Waiting for unfinished jobs....
~~~

This happens on RHEL7 with following compiler:

~~~
$ rpm -q gcc
gcc-4.8.5-16.el7_4.3.x86_64
~~~

This was probably introduced by r65077. It should be fixed IMO, unless #15347 is accepted.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>