This code has been working forever: $ g++ -v Using built-in specs. Target: i686-pc-cygwin Configured with: /cygdrive/f/Home/cvsroot/gcc/configure --verbose --enable-threads --disable-nls --disable-win32-registry --enable-languages=c,c++ Thread model: posix gcc version 4.4.0 20080823 (experimental) (GCC) User@MCKELVEY-XP ~/PD $ uname -a CYGWIN_NT-5.1 MCKELVEY-XP 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin $ g++ -c -g -fno-elide-constructors -DUSE_MUTEX=1 -pedantic-errors -Werror -ansi -fno-common -Wall -Wold-style-cast -Wsign-promo -Wpointer-arith -Wundef -Wwrite-strings -Winvalid-pch -Woverloaded-virtual -Wcast-qual -Wextra -Wredundant-decls -Wshadow -Wcast-align -Wcomment -fstrict-aliasing -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wlogical-op -Wconversion -Wmissing-declarations -Wunused -MMD --save-temp -fimplicit-templates -o Types.o Types.cc In file included from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/bits/localefwd.h:48, from /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/locale:46, from Types.h:37, from Types.cc:29: /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/i686-pc-cygwin/bits/c++locale.h: In function 'int std::__convert_from_v(int* const&, char*, int, const char*, ...)': /usr/local/lib/gcc/i686-pc-cygwin/4.4.0/../../../../include/c++/4.4.0/i686-pc-cygwin/bits/c++locale.h:67: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ alias CONFIGURECVS alias CONFIGURECVS='/cygdrive/f/Home/cvsroot/gcc/configure --verbose --enable-threads --disable-nls --disable-win32-registry --enable-languages=c,c++' User@MCKELVEY-XP ~/PD $ alias BUILD alias BUILD='nice make CFLAGS='\'''\'' BOOT_CFLAGS='\'''\'' LIBCFLAGS='\''-g -O'\'' CXXFLAGS='\''-O'\'' LIBCXXFLAGS='\''-g -O'\'' bootstrap'
Created attachment 16135 [details] Compressed preprocessed source
Reducing, -Wconversion causes the ICE.
Confirmed, reduced testcase: int __convert_from_v( ) { char* __old; if (__builtin_strcmp(__old, "C")) {} }
My PR 37230 is presumably a duplicate of this PR. There, valgrind shows for "gcc -Wconcersion": ==26156== Invalid read of size 2 ==26156== at 0x458558: conversion_warning (c-common.c:1571) ==26156== by 0x4593F7: convert_and_check (c-common.c:1839) ==26156== by 0x42BF71: build_binary_op (c-typeck.c:8434) 1571 is this line: 1566 /* If any operand is artificial, then this expression was generated 1567 by the compiler and we do not warn. */ 1568 for (i = 0; i < expr_num_operands; i++) 1569 { 1570 tree op = TREE_OPERAND (expr, i); 1571 if (DECL_P (op) && DECL_ARTIFICIAL (op)) 1572 return; 1573 } Working: 2008-08-20-r139252 Failing: 2008-08-21-r139367 Failing: 20080824 (experimental) [trunk revision 139535]
Manuel, I think it was caused by your check in for: 2008-08-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/35602 * c-common.c (conversion_warning): Do not want for artificial expressions. It fits time wise and valgrind points at lines you added there.
(In reply to comment #5) > Manuel, I think it was caused by your check in for: > > 2008-08-17 Manuel Lopez-Ibanez <manu@gcc.gnu.org> > > PR c++/35602 > * c-common.c (conversion_warning): Do not want for artificial > expressions. > > It fits time wise and valgrind points at lines you added there. I cannot reproduce this with any of the testcases in x86_64-unknow-linux-gnu and that is all I have access to. Please attach your testcase from PR37230 and if it could be reduced for x86_64-unknow-linux-gnu by Andrew or someone else, that would be extremely helpful.
Created attachment 16144 [details] test2.i.gz > I cannot reproduce this with any of the testcases in x86_64-unknow-linux-gnu > and that is all I have access to. Please attach your testcase from PR37230 and > if it could be reduced for x86_64-unknow-linux-gnu by Andrew or someone else, > that would be extremely helpful. Test case from PR37230. Run as: $ gcc -Wconversion test2.i That gives the mentioned segfault and the valgrind error on my x86_64-unknow-linux-gnu.
The fix is trivial: Index: gcc/c-common.c =================================================================== --- gcc/c-common.c (revision 139373) +++ gcc/c-common.c (working copy) @@ -1566,11 +1566,11 @@ conversion_warning (tree type, tree expr /* If any operand is artificial, then this expression was generated by the compiler and we do not warn. */ for (i = 0; i < expr_num_operands; i++) { tree op = TREE_OPERAND (expr, i); - if (DECL_P (op) && DECL_ARTIFICIAL (op)) + if (op && DECL_P (op) && DECL_ARTIFICIAL (op)) return; } switch (TREE_CODE (expr)) { However, the testcase is too big for the testsuite...
(In reply to comment #8) > However, the testcase is too big for the testsuite... The C++ testcase I attached is small. See comment #4.
(In reply to comment #9) > (In reply to comment #8) > > However, the testcase is too big for the testsuite... > The C++ testcase I attached is small. See comment #4. I don't get the ICE with that testcase in x86_64-unknown-linux-gnu.
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #8) > > > However, the testcase is too big for the testsuite... > > The C++ testcase I attached is small. See comment #4. > > I don't get the ICE with that testcase in x86_64-unknown-linux-gnu. > Reduced testcase for x86_64-unknown-linux-gnu. typedef struct Tcl_ResolvedVarInfo { char *re_guts; } regex_t; void TclReComp(regex_t *re) { if (re->re_guts == ((void *)0)) ; }
Patch: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01913.html Please test that it fixes the ICE in i686-pc-cygwin. Thanks.
*** Bug 37230 has been marked as a duplicate of this bug. ***
Subject: Bug 37217 Author: manu Date: Thu Aug 28 00:00:49 2008 New Revision: 139682 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139682 Log: 2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 37217 * c-common.c (convesion_warning): Check for null operands. testsuite/ * gcc.dg/pr37217.c: New. Added: trunk/gcc/testsuite/gcc.dg/pr37217.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-common.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 37217 Author: manu Revision: 139682 Modified property: svn:log Modified: svn:log at Thu Aug 28 00:09:20 2008 ------------------------------------------------------------------------------ --- svn:log (original) +++ svn:log Thu Aug 28 00:09:20 2008 @@ -1,6 +1,6 @@ 2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 37217 - * c-common.c (convesion_warning): Check for null operands. + * c-common.c (conversion_warning): Check for null operands. testsuite/ * gcc.dg/pr37217.c: New.
Fixed in GCC 4.4.
(In reply to comment #12) > Patch: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01913.html > > Please test that it fixes the ICE in i686-pc-cygwin. Thanks. > Yes! Thanks!