Project

General

Profile

Actions

Bug #17385

closed

Test failures on gcc 11

Added by jaruga (Jun Aruga) almost 4 years ago. Updated almost 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0