Project

General

Profile

Actions

Bug #17540

closed

A segfault due to Clang/LLVM optimization on 32-bit ARM Linux

Added by xtkoba (Tee KOBAYASHI) over 3 years ago. Updated about 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [armv7a-linux-eabi]
[ruby-core:102083]

Description

When built with optflags=-O3 (which is the default), ruby -e "pp Thread.main" causes a segfault, which seems to be worked around by the following change:

--- a/include/ruby/internal/fl_type.h
+++ b/include/ruby/internal/fl_type.h
@@ -231,7 +231,7 @@
 RBIMPL_ATTR_PURE_UNLESS_DEBUG()
 RBIMPL_ATTR_ARTIFICIAL()
 static inline VALUE
-RB_FL_TEST_RAW(VALUE obj, VALUE flags)
+RB_FL_TEST_RAW(volatile VALUE obj, VALUE flags)
 {
     RBIMPL_ASSERT_OR_ASSUME(RB_FL_ABLE(obj));
     return RBASIC(obj)->flags & flags;

There might be a bug in the optimizer of Clang/LLVM (version 11.0.1).

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0