Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 648802 - dev-lang/rust-1.23.0-r1 - src/src/binaryen/src/support/command-line.cpp:112:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
Summary: dev-lang/rust-1.23.0-r1 - src/src/binaryen/src/support/command-line.cpp:112:1...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-02-26 05:43 UTC by Thomas
Modified: 2018-11-15 10:37 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for one of the failing places (optimizer-shared.cpp.patch,1.06 KB, patch)
2018-02-26 05:45 UTC, Thomas
Details | Diff
output of emerge --info ... (emerge-info.txt,7.97 KB, text/plain)
2018-03-01 06:05 UTC, Thomas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas 2018-02-26 05:43:47 UTC
Compilation fails in several places due to uncommented switch/case statements which are supposed to fall through.

Reproducible: Always

Steps to Reproduce:
1.emerge dev-lang/rust

Actual Results:  
--- stderr
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/support/command-line.cpp: In member function 'void wasm::Options::parse(int, const char**)':
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/support/command-line.cpp:112:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
           if (positionalsSeen) {
           ^~
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/support/command-line.cpp:118:9: note: here
         case Arguments::N:
         ^~~~
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/support/command-line.cpp:150:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if (option->seen) {
         ^~
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/support/command-line.cpp:156:7: note: here
       case Arguments::N:
       ^~~~
cc1plus: all warnings being treated as errors
gmake[3]: *** [src/support/CMakeFiles/support.dir/build.make:135: src/support/CMakeFiles/support.dir/command-line.cpp.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/Makefile2:830: src/support/CMakeFiles/support.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp: In function 'AsmSign detectSign(cashew::Ref, cashew::IString)':
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp:157:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if (op == TRSHIFT) return ASM_UNSIGNED;
         ^~
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp:159:7: note: here
       case '|': // fallthrough
       ^~~~
cc1plus: all warnings being treated as errors
gmake[3]: *** [src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/build.make:63: src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/optimizer-shared.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:720: src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:172: CMakeFiles/binaryen.dir/rule] Error 2
gmake: *** [Makefile:190: binaryen] Error 2



I tried to fix one of the affected locations (see attached patch), hoping that it was the only one, but then come the next ones... :-(
Comment 1 Thomas 2018-02-26 05:45:14 UTC
Created attachment 521062 [details, diff]
patch for one of the failing places
Comment 2 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-02-26 10:33:54 UTC
Are you running with unconventional compiler flags here? I'm not sure why you see this and I don't.
Comment 3 Thomas 2018-02-27 06:19:18 UTC
What do you mean with "unconventional" compiler flags? Are these here "unconventional":

CFLAGS="-O2 -g -ggdb -gdwarf-4 -march=native -mtune=native -mpopcnt -fomit-frame-pointer -frename-registers -pipe"

As you see, I do not set any "warning" related options and the -Werror=... does definitely not come from me!

Obviously the author has had the same kinds of warnings before, as he already has used "//fallthrough" statements in many many places - but not 100% consequently. So it looks like an upstream problem...

I have absolutely no idea why I shall be the one and only human being on this planet who has that problem... Maybe it be that you use a different compiler?
I use: sys-devel/gcc-7.2.0-r1:7.2.0

(I can switch to sys-devel/gcc-7.3.0:7.3.0 and try again, but I don't expect any change)
Comment 4 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-02-28 09:40:32 UTC
Might be helpful to just post your full emerge --info. By unconventional, I simply mean that you are using flags that all other users so far are not using (since yours is the first bug report about this). I think you might be better off working with upstream, since this does not appear to be a packaging issue.
Comment 5 Thomas 2018-03-01 06:02:52 UTC
Well, the CFLAGS that I use do not have any influence.
I tried with generic flags:
CFLAGS="-O2 -mtune=native" CXXFLAGS="-O2 -mtune=native" emerge -uv1 =dev-lang/rust-1.23.0-r1:stable/1.23::gentoo =virtual/rust-1.23.0::gentoo

But that doesn't affect the command line that is failing in any way.
If I scroll back a bit, I can see a cmake invocation that checks for some extra flags.

There you can clearly see how it probes for "-Werror" !!!


running: "cmake" "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/librustc_binaryen/../binaryen" "-DBUILD_STATIC_LIB=ON" "-DCMAKE_INSTALL_PREFIX=/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/rustc_binaryen-d16520c0277199c9/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -ffunction-sections -fdata-sections -fPIC -mtune=native -m64 -m64" "-DCMAKE_C_COMPILER=/usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -ffunction-sections -fdata-sections -fPIC -mtune=native -m64 -m64" "-DCMAKE_CXX_COMPILER=/usr/lib64/ccache/bin/x86_64-pc-linux-gnu-g++" "-DCMAKE_BUILD_TYPE=Release"
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc
-- Check for working C compiler: /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-g++
-- Check for working CXX compiler: /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Building with -std=c++11
-- Building for platform x86-64
-- Building with -Wall
-- Building with -Werror
-- Building with -Wextra
-- Building with -Wno-unused-parameter
-- Building with -fno-omit-frame-pointer
-- Building with -fPIC
-- Building with -O2
-- Building with -UNDEBUG
-- Configuring done
-- Generating done
-- Build files have been written to: /var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/rustc_binaryen-d16520c0277199c9/out/build
running: "cmake" "--build" "." "--target" "binaryen" "--config" "Release" "--"
Scanning dependencies of target ir
Scanning dependencies of target wasm


[...]


[ 82%] Building CXX object src/passes/CMakeFiles/passes.dir/Vacuum.cpp.o
[ 83%] Linking CXX static library ../../lib/libpasses.a
[ 83%] Built target passes

--- stderr
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp: In function 'AsmSign detectSign(cashew::Ref, cashew::IString)':
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp:157:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if (op == TRSHIFT) return ASM_UNSIGNED;
         ^~
/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/binaryen/src/emscripten-optimizer/optimizer-shared.cpp:159:7: note: here
       case '|': // fallthrough
       ^~~~
cc1plus: all warnings being treated as errors
gmake[3]: *** [src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/build.make:63: src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/optimizer-shared.cpp.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/Makefile2:720: src/emscripten-optimizer/CMakeFiles/emscripten-optimizer.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:172: CMakeFiles/binaryen.dir/rule] Error 2
gmake: *** [Makefile:190: binaryen] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', src/vendor/cmake/src/lib.rs:631:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
thread 'main' panicked at 'command did not execute successfully: "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rust-stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "5" "-v" "--release" "--locked" "--frozen" "--features" " jemalloc llvm" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/rustc/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', src/bootstrap/compile.rs:877:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 758, in main
    bootstrap()
  File "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 749, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/src/bootstrap/bootstrap.py", line 148, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/build/bootstrap/debug/bootstrap build --verbose --config=/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src/config.toml -j5
 * ERROR: dev-lang/rust-1.23.0-r1::gentoo failed (compile phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 124:  Called src_compile
 *   environment, line 2223:  Called die
 * The specific snippet of code:
 *       ./x.py build --verbose --config="${S}"/config.toml -j$(makeopts_jobs) || die
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/rust-1.23.0-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/rust-1.23.0-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/rust-1.23.0-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/rust-1.23.0-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src'
 * S: '/var/tmp/portage/dev-lang/rust-1.23.0-r1/work/rustc-1.23.0-src'

>>> Failed to emerge dev-lang/rust-1.23.0-r1
Comment 6 Thomas 2018-03-01 06:05:23 UTC
Created attachment 521524 [details]
output of emerge --info ...
Comment 7 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-03-01 09:01:39 UTC
Interesting! Perhaps it's the compiler version? I'm still on gcc-6.4.
Comment 8 Thomas 2018-03-02 06:12:58 UTC
update:
I made it build now, by passing special CFLAGS 
(including "-Wno-implicit-fallthrough") :

CFLAGS="-O2 -mtune=native -Wno-implicit-fallthrough" CXXFLAGS="-O2 -mtune=native -Wno-implicit-fallthrough" emerge -uv1 =dev-lang/rust-1.23.0-r1:stable/1.23::gentoo =virtual/rust-1.23.0::gentoo
Comment 9 Amir Guindehi 2018-03-02 23:29:46 UTC
I can confirm this. I was not able to compile rust-1.23-r1 with gcc 7.3. 
Adding the flags Thomas described made it build and install...
Comment 10 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-11-15 10:37:06 UTC
Going to close this as obsolete, please reopen if you still see this with 1.30.1.