Project

General

Profile

Actions

Bug #12383

closed

Warnings when compiling proc.c on cygwin

Added by duerst (Martin Dürst) almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-05-15 trunk 55004) [x86_64-cygwin]
[ruby-core:75510]

Description

When compiling ruby on cygwin, I get the following warnings for proc.c:

compiling proc.c
proc.c: In function ‘call_method_data_safe’:
proc.c:1984:11: warning: variable ‘result’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
     VALUE result = Qnil; /* OK */
           ^
proc.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’
compiling random.c

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Feedback
  • Description updated (diff)

I don't see that warning, with optflags=-O0 .. -O3.

$ LANG=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-5.x86_64/src/gcc-5.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-5.x86_64/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (GCC) 

Updated by duerst (Martin Dürst) almost 8 years ago

  • Status changed from Feedback to Open

Here's my gcc version information:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.x86_64/src/gcc-5.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.x86_64/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (GCC)

And here are the settings used in my case:

configure: creating ./config.status
---
Configuration summary for ruby version 2.4.0

   * Installation prefix: /usr/local
   * exec prefix:         ${prefix}
   * arch:                x86_64-cygwin
   * site arch:           ${arch}
   * RUBY_BASE_NAME:      ruby
   * enable shared:       yes
   * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
   * site libraries path: ${rubylibprefix}/${sitearch}
   * vendor path:         ${rubylibprefix}/vendor_ruby
   * target OS:           cygwin
   * compiler:            gcc
   * with pthread:        yes
   * enable shared libs:  yes
   * dynamic library ext: so
   * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -fstack-protector
   * optflags:            -O3 -fno-fast-math -fexcess-precision=standard
   * debugflags:          -ggdb3
   * warnflags:           -Wall -Wextra -Wno-unused-parameter \
                          -Wno-parentheses -Wno-long-long \
                          -Wno-missing-field-initializers \
                          -Wno-tautological-compare \
                          -Wno-parentheses-equality \
                          -Wno-constant-logical-operand -Wno-self-assign \
                          -Wunused-variable -Werror=implicit-int \
                          -Werror=pointer-arith -Werror=write-strings \
                          -Werror=declaration-after-statement \
                          -Werror=implicit-function-declaration \
                          -Werror=deprecated-declarations \
                          -Wno-packed-bitfield-compat \
                          -Wsuggest-attribute=noreturn \
                          -Wsuggest-attribute=format \
                          -Wno-maybe-uninitialized
   * strip command:       strip
   * install doc:         no
   * man page type:       doc

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-3.x86_64/src/gcc-5.3.0/configure

Seems older a little.

Updated by duerst (Martin Dürst) almost 8 years ago

I updated to

/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-5.x86_64/src/gcc-5.3.0/configure

but the error persists.

Updated by rhenium (Kazuki Yamaguchi) almost 8 years ago

I'm also seeing the warning on my Linux box with GCC 6.1.1/5.3.0. Removing "-Wsuggest-attribute=noreturn" from configure.in fixes for me. There is a difference in configure output.

With -Wsuggest-attribute=noreturn:

checking for __builtin_setjmp... no
checking for setjmp type... _setjmp

Without -Wsuggest-attribute=noreturn:

checking for __builtin_setjmp... yes with cast ()
checking for setjmp type... __builtin_setjmp

The problem is in the check program. -Wsuggest-attribute=noreturn suggests adding noreturn to t(), but this is compiled with -Werror and check fails.

#include <setjmp.h>
#include <stdio.h>

jmp_buf jb;
void t(void) {__builtin_longjmp((void **) jb, 1);}
int jump(void) {(void)(__builtin_setjmp((void **) jb) ? 1 : 0); return 0;}

int main(void)
{
	void (*volatile f)(void) = t;
	if (!jump()) printf("%d\n", f != 0);
	return 0;
}
Actions #6

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Closed

Applied in changeset r55023.


configure.in: declare as NORETURN

  • configure.in (RUBY_CHECK_BUILTIN_SETJMP): declare t as NORETURN
    to suppress warnings by -Wsuggest-attribute=noreturn.
    [ruby-core:75510] [Bug #12383]

Updated by usa (Usaku NAKAMURA) almost 8 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONTNEED
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0