On Wed, May 04, 2022 at 10:57:57AM +0200, Richard Biener wrote: > On Wed, 4 May 2022, Jakub Jelinek wrote: > > > Hi! > > > > Somebody complained on IRC that when writing a new backend one can get > > an error while compiling build/gencondmd.cc. > > The problem is that when host compiler is g++ 3 or later (or when > > bootstrapping), we compile it with g++ -std=c++11 -pedantic and > > the generated insn_conditions array contains pairs > > { "cond", __builtin_constant_p (cond) ? (int) (cond) : -1 }, > > where cond is some non-trivial instruction condition. Now if a target > > uses "" for all the conditions (admittedly unlikely for non-trivial > > target), the initializer for insn_conditions[] is {} and that is > > pedantically rejected because C++ doesn't support zero-sized arrays. > > > > The following patch fixes that by adding an artificial termination > > element and skips that during the walk. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, no change in > > generated insn-conditions.md with it. Ok for trunk? > > OK. > > I wonder what the generated GCC_VERSION conditions are about ...
To determine if an insn condition is compile time constant or not. If it is and e.g. it is always false, it can just omit the insn altogether, etc. See https://gcc.gnu.org/legacy-ml/gcc-patches/2006-01/msg00394.html for more details. Jakub