Bug #14425
closed
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED
- Status changed from Open to Closed
Applied in changeset trunk|r62116.
ruby.h: relax rb_funcall check on extra args for clang
clang 5.+ (tested clang 7.0.0) seems to be attempting division-by-zero
and giving a very large number for static args to rb_funcall.
- include/ruby/ruby.h (rb_varargs_bad_length): relax check for clang
- ext/-test-/funcall/funcall.c: renamed from passing_block.c
define extra_args_name function
- test/-ext-/funcall/test_funcall.rb: new test
[ruby-core:85266] [Bug #14425]
From: Eric Wong e@80x24.org
normalperson (Eric Wong) wrote:
Attached are over 500 gem-codesearch results of latest gems.
nitpick: Your query includes rb_funcall2
, rb_funcall3
, and rb_funcallv
which are safe to pass "0, 0
".
mame@ruby-lang.org wrote:
normalperson (Eric Wong) wrote:
Attached are over 500 gem-codesearch results of latest gems.
nitpick: Your query includes rb_funcall2
, rb_funcall3
, and rb_funcallv
which are safe to pass "0, 0
".
Oops :x
Btw, I guess this is undefined behavior?
In a standalone case, gcc prints "0", clang prints a randomly high
number. I expected compilation to fail with both compilers.
/* $CC -O2 -Wextra -Wall -o divzero /path/to/this/file.c */
#include <stdio.h>
int main(void)
{
int a = 0;
int b = 1;
int c = a / (a == b);
printf("%d\n", c);
return 0;
}
- Backport changed from 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONE
ruby_2_5 r62501 merged revision(s) 62116,62151.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0