As reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436#c12: Romain Geissler 2019-01-07 14:41:34 UTC Hi, I have tried the following script directly inside docker using the official "debian:buster" docker image, so I hope it will not require much more dependencies than what is written here. Tested with x86-64. <<END_OF_SCRIPT #!/bin/bash set -e # Install a few dependencies apt-get update apt-get install -y curl tar build-essential cmake python LLVM_DIRECTORY=/llvm LLVM_TAR="http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz" CLANG_TAR="http://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz" COMPILER_RT_TAR="http://releases.llvm.org/7.0.1/compiler-rt-7.0.1.src.tar.xz" mkdir -p "${LLVM_DIRECTORY}/src" mkdir -p "${LLVM_DIRECTORY}/build" cd "${LLVM_DIRECTORY}/src" curl "${LLVM_TAR}" | tar -Jx --strip-components=1 -f - mkdir -p "${LLVM_DIRECTORY}/src/tools/clang" cd "${LLVM_DIRECTORY}/src/tools/clang" curl "${CLANG_TAR}" | tar -Jx --strip-components=1 -f - mkdir -p "${LLVM_DIRECTORY}/src/projects/compiler-rt" cd "${LLVM_DIRECTORY}/src/projects/compiler-rt" curl "${COMPILER_RT_TAR}" | tar -Jx --strip-components=1 -f - cd "${LLVM_DIRECTORY}/build" cmake -G "Unix Makefiles" -C "${LLVM_DIRECTORY}/src/tools/clang/cmake/caches/PGO.cmake" "${LLVM_DIRECTORY}/src" make -j 32 stage2-instrumented-generate-profdata END_OF_SCRIPT in order to use your own gcc, make sure that you update the $PATH environment variable when running cmake/make. I suggest you build clang both with and without your fix in gcc, then explore the whole build tree and find all *.o files which differ (I hope there aren't a lot), to check why they behave differently. Note that it seems like gcc had an earlier regression, making the clang bootstrap fail a bit later after building compiler-rt, with an error like: FAILED: tools/clang/include/clang/AST/StmtNodes.inc cd /workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins && /workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins/bin/clang-tblgen -gen-clang-stmt-nodes -I /workdir/src/llvm-8.0.0/clang/include/clang/AST -I /workdir/src/llvm-8.0.0/llvm/include /workdir/src/llvm-8.0.0/clang/include/clang/AST/../Basic/StmtNodes.td -o tools/clang/include/clang/AST/StmtNodes.inc -d tools/clang/include/clang/AST/StmtNodes.inc.d This is an unrelated error, which I think comes from a gcc regression too, and which I will bisect as well. If you need more info, just ask. Cheers, Romain
Mine. Also
Mine, also seen in libzip package.
Reduced test-case: $ cat zip.c typedef unsigned short int uint16_t; typedef unsigned char uint8_t; uint16_t length; uint16_t enc_method_global; uint8_t __attribute__((noipa)) _zip_buffer_get_8(int buffer) { return buffer; } int __attribute__((noipa)) foo(int v) { uint16_t enc_method; switch (_zip_buffer_get_8(v)) { case 1: enc_method = 0x0101; break; case 2: enc_method = 0x0102; break; case 3: enc_method = 0x0103; break; default: __builtin_abort (); } enc_method_global = enc_method; } int main(int argc, char **argv) { foo (1); if (enc_method_global != 0x0101) __builtin_abort (); return 0; }
I'm testing patch for that.
Author: marxin Date: Tue Jan 8 14:45:28 2019 New Revision: 267728 URL: https://gcc.gnu.org/viewcvs?rev=267728&root=gcc&view=rev Log: Use proper type in linear transformation in tree-switch-conversion (PR tree-optimization/88753). 2019-01-08 Martin Liska <mliska@suse.cz> PR tree-optimization/88753 * tree-switch-conversion.c (switch_conversion::build_one_array): Come up with local variable constructor. Convert first to type of constructor values. 2019-01-08 Martin Liska <mliska@suse.cz> PR tree-optimization/88753 * gcc.dg/tree-ssa/pr88753.c: New test. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr88753.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-switch-conversion.c
Fixed.
*** Bug 88609 has been marked as a duplicate of this bug. ***