Project

General

Profile

Actions

Bug #17385

closed

Test failures on gcc 11

Added by jaruga (Jun Aruga) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:101381]

Description

There is gcc 11 (development version) [1].
On Fedora rawhide (Fedora 34), the gcc version is 11.0.0-0.7.fc34. I got 2 test failures on Fedora 34. The failures come from a warning -Wsizeof-array-div that is a new feature on gcc 11.

Here is the log.

+ make check 'TESTS=-v ' 'MSPECOPT=-fs  -P '\''raises TypeError if one of the passed exceptions is not a Module'\'''
...
  1) Failure:
TestMkmf::TestConvertible#test_typeof_builtin [/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/test/mkmf/test_convertible.rb:9]:
convertible_int: checking for convertible type of short... -------------------- short
--------------------
convertible_int: checking for convertible type of int... -------------------- int
--------------------
convertible_int: checking for convertible type of long... -------------------- long
--------------------
convertible_int: checking for convertible type of signed short... -------------------- failed
"gcc -o conftest -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC conftest.c  -L. -L/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a -L. -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic  -m64   -lruby-static -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm   -lm   -lc"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64  -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: /*top*/
6: int conftest_const[((rbcv_typedef_)-1 < 0) ? 1 : -1];
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:12: error: conflicting types for 'foo'
    6 | extern int foo();
      |            ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern int foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern short foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:13: error: conflicting types for 'foo'
    6 | extern long foo();
      |             ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern long foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:18: error: conflicting types for 'foo'
    6 | extern long long foo();
      |                  ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern long long foo();
/* end */
--------------------
.
<"short"> expected but was
<nil>.
  2) Failure:
TestMkmf::TestConvertible#test_typeof_typedef [/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/test/mkmf/test_convertible.rb:22]:
convertible_int: checking for convertible type of test1_t... -------------------- failed
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64  -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: typedef test1_t rbcv_typedef_;
5: 
6: /*top*/
7: int conftest_const[((rbcv_typedef_)-1 < 0) ? 1 : -1];
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:12: error: conflicting types for 'foo'
    8 | extern int foo();
      |            ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern int foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern short foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:13: error: conflicting types for 'foo'
    8 | extern long foo();
      |             ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern long foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:18: error: conflicting types for 'foo'
    8 | extern long long foo();
      |                  ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern long long foo();
/* end */
--------------------
.
<"short"> expected but was
<nil>.
Finished tests in 806.091775s, 25.9722 tests/s, 3308.1320 assertions/s.
20936 tests, 2666658 assertions, 2 failures, 0 errors, 52 skips
ruby -v: ruby 3.0.0dev (2020-12-04 master 1cfc6e7b7a) [x86_64-linux]

Seeing the gcc 11 release note [2], it seems that the new warning -Wsizeof-array-div causes the failures.

C family
New warnings:
-Wsizeof-array-div, enabled by -Wall, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.

Here is the detail of the warning. [3]

Could you fix it? Thank you.

[1] https://gcc.gnu.org/
[2] https://gcc.gnu.org/gcc-11/changes.html
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91741

Updated by jaruga (Jun Aruga) about 4 years ago

The Ruby I tested is the commit 1cfc6e7b7a92c1a624182392ba702d3dcb2eba98 on master branch.

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

Does this work?

diff --git a/include/ruby/internal/core/rbasic.h b/include/ruby/internal/core/rbasic.h
index 2b578b663c8..603ebacdffb 100644
--- a/include/ruby/internal/core/rbasic.h
+++ b/include/ruby/internal/core/rbasic.h
@@ -36,7 +36,17 @@
 #define RVALUE_EMBED_LEN_MAX RVALUE_EMBED_LEN_MAX
 
 /** @cond INTERNAL_MACRO */
+#if RBIMPL_HAS_WARNING("-Wsizeof-array-div")
 #define RBIMPL_EMBED_LEN_MAX_OF(T) \
+    RBIMPL_WARNING_PUSH() \
+    RBIMPL_WARNING_IGNORED(-Wsizeof-array-div) \
+    RBIMPL_EMBED_LEN_MAX_OF_(T) \
+    RBIMPL_WARNING_POP()
+#else
+#define RBIMPL_EMBED_LEN_MAX_OF(T) \
+    RBIMPL_EMBED_LEN_MAX_OF_(T)
+#endif
+#define RBIMPL_EMBED_LEN_MAX_OF_(T) \
     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
 /** @endcond */
 
Actions #3

Updated by naruse (Yui NARUSE) about 4 years ago

  • Target version set to 3.0

Updated by jaruga (Jun Aruga) about 4 years ago

Thanks for the patch! Let me check it tomorrow!

Updated by shyouhei (Shyouhei Urabe) about 4 years ago

Hello, I have encountered similar warnings in clang and had some fix at this commit https://github.com/ruby/ruby/commit/2366c681166a1dab95de6b9ca8ffcaae18aadd39

In case of clang adding parens suppress the warning. Doesn't this work for gcc as well?

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

shyouhei (Shyouhei Urabe) wrote in #note-5:

Hello, I have encountered similar warnings in clang and had some fix at this commit https://github.com/ruby/ruby/commit/2366c681166a1dab95de6b9ca8ffcaae18aadd39

Interesting, but I can't reproduce that warning with clang-{10,11} of Ubuntu and MacPorts.

/* conftest.c */
#include <stdio.h>
#include <setjmp.h>
int main(void)
{
    printf("%zd\n", sizeof(jmp_buf)/sizeof(int));
    return 0;
}
$ clang-10 --version
Ubuntu clang version 10.0.1-6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ clang-10 -Wall -Werror=sizeof-array-div -c conftest.c && echo ok
ok
 
$ clang-10 -O3 -Wall -Werror=sizeof-array-div -c conftest.c && echo ok
ok

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

Anyway, if no warning against the line in vm.c, the same will work against RBIMPL_EMBED_LEN_MAX_OF macro.

Updated by shyouhei (Shyouhei Urabe) about 4 years ago

clang warns on this one, not sure why though.

https://gcc.godbolt.org/z/c7baPr

#include <stddef.h>
#include <setjmp.h>
struct foo_tag {
    jmp_buf foo;
} foo;

size_t
bar()
{
    return sizeof(foo.foo) / sizeof(int);
}

Updated by jaruga (Jun Aruga) about 4 years ago

Does this work?

I tested with the patch. But no it does not work. Here is the log. Sorry for the long long.
I noticed the warnings appear at the timing of the make.
In the log the 1) Failure I see today might be not related to the gcc 11 issue.

+ /usr/bin/make -O -j8 V=1 VERBOSE=1 'COPY=cp -p' Q=
    BASERUBY = echo executable host ruby is required.  use --with-baseruby option.; false
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64
    XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0
    CPPFLAGS =   
    DLDFLAGS = -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-soname,libruby.so.3.0 -fstack-protector-strong  -m64
    SOLIBS = -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm 
    LANG = C
    LC_ALL = 
    LC_CTYPE = 
    MFLAGS = -j8 -Otarget --jobserver-auth=4,5
gcc (GCC) 11.0.0 20201204 (Red Hat 11.0.0-0)
Copyright (C) 2020 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.
gcc -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0    -o dmyext.o -c dmyext.c
gcc -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0    -o dmydln.o -c dmydln.c
In file included from ./include/ruby/internal/assume.h:29,
                 from ./include/ruby/backward/2/assume.h:24,
                 from ./include/ruby/defines.h:73,
                 from ./include/ruby/ruby.h:23,
                 from dmydln.c:1:
./include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
./include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
./include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
./include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
./include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
./include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
...
+ make check 'TESTS=-v ' 'MSPECOPT=-fs  -P '\''raises TypeError if one of the passed exceptions is not a Module'\'''
    BASERUBY = echo executable host ruby is required.  use --with-baseruby option.; false
    CC = gcc
    LD = ld
    LDSHARED = gcc -shared
    CFLAGS = -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64
    XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0
    CPPFLAGS =   
    DLDFLAGS = -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-soname,libruby.so.3.0 -fstack-protector-strong  -m64
    SOLIBS = -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm 
    LANG = C
    LC_ALL = 
    LC_CTYPE = 
    MFLAGS = 
...
  1) Failure:
TestBundledCA#test_accessing_rubygems [/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/test/rubygems/test_bundled_ca.rb:46]:
rubygems.org is not verifiable using the included certificates. Error was: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
  2) Failure:
TestMkmf::TestConvertible#test_typeof_builtin [/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/test/mkmf/test_convertible.rb:9]:
convertible_int: checking for convertible type of short... -------------------- short
--------------------
convertible_int: checking for convertible type of int... -------------------- int
--------------------
convertible_int: checking for convertible type of long... -------------------- long
--------------------
convertible_int: checking for convertible type of signed short... -------------------- failed
"gcc -o conftest -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC conftest.c  -L. -L/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a -L. -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -rdynamic -Wl,-export-dynamic  -m64   -lruby-static -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm   -lm   -lc"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64  -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: /*top*/
6: int conftest_const[((rbcv_typedef_)-1 < 0) ? 1 : -1];
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:12: error: conflicting types for 'foo'
    6 | extern int foo();
      |            ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern int foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern short foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:13: error: conflicting types for 'foo'
    6 | extern long foo();
      |             ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern long foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:6:18: error: conflicting types for 'foo'
    6 | extern long long foo();
      |                  ^~~
conftest.c:5:22: note: previous declaration of 'foo' was here
    5 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: typedef signed short rbcv_typedef_;
4: 
5: extern rbcv_typedef_ foo();
6: extern long long foo();
/* end */
--------------------
.
<"short"> expected but was
<nil>.
  3) Failure:
TestMkmf::TestConvertible#test_typeof_typedef [/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/test/mkmf/test_convertible.rb:22]:
convertible_int: checking for convertible type of test1_t... -------------------- failed
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64  -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: typedef test1_t rbcv_typedef_;
5: 
6: /*top*/
7: int conftest_const[((rbcv_typedef_)-1 < 0) ? 1 : -1];
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:12: error: conflicting types for 'foo'
    8 | extern int foo();
      |            ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern int foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern short foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:13: error: conflicting types for 'foo'
    8 | extern long foo();
      |             ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern long foo();
/* end */
"gcc -I. -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/.ext/include/x86_64-linux -I/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include -I./test    -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -Werror -c conftest.c"
In file included from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/assume.h:29,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/backward/2/assume.h:24,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/defines.h:73,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/ruby.h:23,
                 from /builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby.h:31,
                 from conftest.c:1:
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: error: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Werror=sizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~
conftest.c:8:18: error: conflicting types for 'foo'
    8 | extern long long foo();
      |                  ^~~
conftest.c:7:22: note: previous declaration of 'foo' was here
    7 | extern rbcv_typedef_ foo();
      |                      ^~~
cc1: all warnings being treated as errors
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <confdefs.h>
4: 
5: typedef test1_t rbcv_typedef_;
6: 
7: extern rbcv_typedef_ foo();
8: extern long long foo();
/* end */
--------------------
.
<"short"> expected but was
<nil>.
Finished tests in 652.047166s, 32.1096 tests/s, 4087.8914 assertions/s.
20937 tests, 2665498 assertions, 3 failures, 0 errors, 52 skips
ruby -v: ruby 3.0.0dev (2020-12-04 master 1cfc6e7b7a) [x86_64-linux]

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

jaruga (Jun Aruga) wrote in #note-9:

./include/ruby/internal/core/rbasic.h:40:59: warning: expression does not compute the number of elements in this array; element type is 'VALUE' {aka 'long unsigned int'}, not 'char' [-Wsizeof-array-div]
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^
./include/ruby/internal/cast.h:33:29: note: in definition of macro 'RBIMPL_CAST'
   33 | # define RBIMPL_CAST(expr) (expr)
      |                             ^~~~
./include/ruby/internal/core/rstring.h:70:31: note: in expansion of macro 'RBIMPL_EMBED_LEN_MAX_OF'
   70 |     RSTRING_EMBED_LEN_MAX   = RBIMPL_EMBED_LEN_MAX_OF(char) - 1
      |                               ^~~~~~~~~~~~~~~~~~~~~~~

As this call trace is same as the before, the patch doesn't seem to be applied.

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

jaruga (Jun Aruga) wrote:

/builddir/build/BUILD/ruby-3.0.0-1cfc6e7b7a/include/ruby/internal/core/rbasic.h:40:59: note: add parentheses around the second 'sizeof' to silence this warning
   40 |     RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
      |                                                           ^

I've missed the same note.

Actions #12

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|68af5235292f82145c599038b4bff7d9225e62d7.


Added parentheses to silence sizeof-array-div warnings [Bug #17385]

As well as 2366c681166a1dab95de6b9ca8ffcaae18aadd39.

Actions #13

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED

Updated by jaruga (Jun Aruga) about 4 years ago

Applied in changeset git|68af5235292f82145c599038b4bff7d9225e62d7.

Thanks! I will try the patch on Monday.

By the way, if you want to try gcc-11 on Ubuntu, I found gcc-11 on ubuntu-toolchain-r repo.
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

Updated by shyouhei (Shyouhei Urabe) about 4 years ago

jaruga (Jun Aruga) wrote in #note-14:

By the way, if you want to try gcc-11 on Ubuntu, I found gcc-11 on ubuntu-toolchain-r repo.
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

JFYI tests for various compiles in our CI suite currently stick to Ubuntu bionic (18.04) because this was the last release which shipped gcc 4.x. OTOH gcc 11 on Ubuntu seems hirsute (21.04) exclusive for now.

It seems someday we have to either drop old gcc or drop recent gcc. We have no bandwidth to maintain gcc binaries.

PS. This is not an issue for clang. I love how LLVM team provides every version they have to every OS they know.

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

shyouhei (Shyouhei Urabe) wrote in #note-15:

JFYI tests for various compiles in our CI suite currently stick to Ubuntu bionic (18.04) because this was the last release which shipped gcc 4.x. OTOH gcc 11 on Ubuntu seems hirsute (21.04) exclusive for now.

It seems someday we have to either drop old gcc or drop recent gcc. We have no bandwidth to maintain gcc binaries.

I've tried autoconf 2.70 in these days, but couldn't compile with gcc 4.9.
So I think we may have to drop old gcc when shipping configure script generated by autoconf 2.70.

Updated by jeremyevans0 (Jeremy Evans) about 4 years ago

nobu (Nobuyoshi Nakada) wrote in #note-16:

shyouhei (Shyouhei Urabe) wrote in #note-15:

JFYI tests for various compiles in our CI suite currently stick to Ubuntu bionic (18.04) because this was the last release which shipped gcc 4.x. OTOH gcc 11 on Ubuntu seems hirsute (21.04) exclusive for now.

It seems someday we have to either drop old gcc or drop recent gcc. We have no bandwidth to maintain gcc binaries.

I've tried autoconf 2.70 in these days, but couldn't compile with gcc 4.9.
So I think we may have to drop old gcc when shipping configure script generated by autoconf 2.70.

What are the advantages of switching to autoconf 2.70 compared to sticking with 2.69? OpenBSD uses gcc 4.2 on many older platforms where clang doesn't work well or work at all. I would hate to lose the ability to use Ruby on these older platforms. If there are substantial benefits to autoconf 2.70, and it isn't possible to achieve those benefits with autoconf 2.69, maybe the benefits outweigh the costs. I'm just not sure what the benefits are.

Updated by nobu (Nobuyoshi Nakada) about 4 years ago

jeremyevans0 (Jeremy Evans) wrote in #note-17:

nobu (Nobuyoshi Nakada) wrote in #note-16:

shyouhei (Shyouhei Urabe) wrote in #note-15:

JFYI tests for various compiles in our CI suite currently stick to Ubuntu bionic (18.04) because this was the last release which shipped gcc 4.x. OTOH gcc 11 on Ubuntu seems hirsute (21.04) exclusive for now.

It seems someday we have to either drop old gcc or drop recent gcc. We have no bandwidth to maintain gcc binaries.

I've tried autoconf 2.70 in these days, but couldn't compile with gcc 4.9.
So I think we may have to drop old gcc when shipping configure script generated by autoconf 2.70.

What are the advantages of switching to autoconf 2.70 compared to sticking with 2.69? OpenBSD uses gcc 4.2 on many older platforms where clang doesn't work well or work at all. I would hate to lose the ability to use Ruby on these older platforms. If there are substantial benefits to autoconf 2.70, and it isn't possible to achieve those benefits with autoconf 2.69, maybe the benefits outweigh the costs. I'm just not sure what the benefits are.

I don't claim we should switch to 2.70 (at least now), but we'll need to be 2.70-ready.
It may be necessary when the platform used by release managers does so in future, but it is not the case now.

Updated by jaruga (Jun Aruga) about 4 years ago

JFYI tests for various compiles in our CI suite currently stick to Ubuntu bionic (18.04) because this was the last release which shipped gcc 4.x. OTOH gcc 11 on Ubuntu seems hirsute (21.04) exclusive for now.

I see. Thanks for the info. My hope is that people in ubuntu-toolchain-r will add gcc-11 for older platforms in near future, as gcc-11 is still in development for now. My another hope for gcc-11 to support the older platforms is the one from Debian side, for Ubuntu to pick up.
It's only available on the experimental repo.
https://tracker.debian.org/pkg/gcc-11

For our CI, I assume you are talking about .github/workflows/compilers.yml, right?
Can not we select os in the matrix of compilers.yml? If we can we can be available gcc-11 on a newer Ubuntu version. I am still not familiar with GitHub Actions syntax.

PS. This is not an issue for clang. I love how LLVM team provides every version they have to every OS they know.

Oh it's cool. Though I am not sure which page you see for the "how LLVM team provides every version they have to every OS they know", I can see the official LLVM site provides clang-11 on Ubuntu 20.04 and 16.04.
https://releases.llvm.org/download.html
https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.0.0
https://packages.ubuntu.com/groovy/clang-11

Updated by jaruga (Jun Aruga) about 4 years ago

Applied in changeset git|68af5235292f82145c599038b4bff7d9225e62d7.

Thanks! I will try the patch on Monday.

I confirmed the commit 68af5235292f82145c599038b4bff7d9225e62d7 worked with gcc-11 on Fedora 34 now! Thanks.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0