Bug 57232 - wcstol.c:213:1: internal compiler error
Summary: wcstol.c:213:1: internal compiler error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Alexandre Oliva
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-10 07:24 UTC by daniel.calcoen
Modified: 2014-02-28 13:01 UTC (History)
4 users (show)

See Also:
Host:
Target: rx-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-02-27 00:00:00


Attachments
output of the make for newlib, where the error message is (17.88 KB, text/plain)
2013-05-10 07:24 UTC, daniel.calcoen
Details
zip with the different configure.out and make.out (218.60 KB, application/x-zip-compressed)
2013-05-10 07:27 UTC, daniel.calcoen
Details
my "touched" configure.host for newlib (5.40 KB, text/plain)
2013-05-10 07:31 UTC, daniel.calcoen
Details
wcstol.i (3.52 KB, text/plain)
2013-05-10 08:28 UTC, daniel.calcoen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description daniel.calcoen 2013-05-10 07:24:31 UTC
Created attachment 30081 [details]
output of the make for newlib, where the error message is

Building my native cross-compiler 

THIS_PLATFORM=i686-pc-linux-gnu
WANTED_COMPILER_PLATFORM=THIS_PLATFORM
WANTED_COMPILER_CODE=rx-elf 

binutils, GMP, MPFR, MPC, 1st part of GCC pass ok
but at the build of newlib I get the message

rx-elf-gcc -B/home/dcalcoen/rx/bld/linux/newlib/rx-elf/64-bit-double/newlib/ -isystem /home/dcalcoen/rx/bld/linux/newlib/rx-elf/64-bit-double/newlib/targ-include -isystem /home/dcalcoen/gitMirror/newlib/newlib/libc/include -B/home/dcalcoen/rx/bld/linux/newlib/rx-elf/64-bit-double/libgloss/rx -L/home/dcalcoen/rx/bld/linux/newlib/rx-elf/64-bit-double/libgloss/libnosys -L/home/dcalcoen/gitMirror/newlib/libgloss/rx  -m64bit-doubles -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"2.0.0\" -DPACKAGE_STRING=\"newlib\ 2.0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I/home/dcalcoen/gitMirror/newlib/newlib/libc/stdlib -ffunction-sections -fdata-sections  -Os -DREENTRANT_SYSCALLS_PROVIDED -DINTERNAL_NEWLIB -DDEFINE_MALLOC -DDEFINE_FREE -DDEFINE_REALLOC -DDEFINE_CALLOC -fno-builtin      -g -O2  -m64bit-doubles -c -o lib_a-wcstol.o `test -f 'wcstol.c' || echo '/home/dcalcoen/gitMirror/newlib/newlib/libc/stdlib/'`wcstol.c
/home/dcalcoen/gitMirror/newlib/newlib/libc/stdlib/wcstol.c: In function "_wcstol_r":
/home/dcalcoen/gitMirror/newlib/newlib/libc/stdlib/wcstol.c:213:1: internal compiler error: in variable_post_merge_new_vals, at var-tracking.c:4430
 }
 ^
0x8548cfc variable_post_merge_new_vals
	/home/dcalcoen/gitMirror/gcc/gcc/var-tracking.c:4430
0x8685165 htab_traverse_noresize
	/home/dcalcoen/gitMirror/gcc/libiberty/hashtab.c:784
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 daniel.calcoen 2013-05-10 07:27:54 UTC
Created attachment 30082 [details]
zip with the different configure.out and make.out

zip with the different configure.out and make.out
I build my gcc cross compiler in 7 steps (building newlib is in step 6)
Comment 2 Marek Polacek 2013-05-10 07:30:48 UTC
Well, we will need the preprocessed source.
Comment 3 daniel.calcoen 2013-05-10 07:31:00 UTC
Created attachment 30083 [details]
my "touched" configure.host for newlib

I added some switches I need to configure.host for newlib
this is the only file I have different from the git repository
Comment 4 daniel.calcoen 2013-05-10 07:33:57 UTC
Hi,

Any file in particular?.

I did a git pull on Wednesday on the 4.8 branch. (and binutils and newlib)
I attached the sh I use to build my cross compiler and the only file I "touched".

Daniel


-----Original Message-----
From: mpolacek at gcc dot gnu.org [mailto:gcc-bugzilla@gcc.gnu.org] 
Sent: 10 May 2013 09:31
To: Daniel Calcoen
Subject: [Bug debug/57232] wcstol.c:213:1: internal compiler error

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57232

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-05-10
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c++                         |debug
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Well, we will need the preprocessed source.
Comment 5 Marek Polacek 2013-05-10 07:44:26 UTC
(In reply to daniel.calcoen from comment #4)
> Hi,
> 
> Any file in particular?.

The one where the ICE occurs, i.e. preprocessed wcstol.c in this case.
Comment 7 Richard Biener 2013-05-10 07:56:20 UTC
The file /home/dcalcoen/gitMirror/newlib/newlib/libc/stdlib/wcstol.c preprocessed
by appending -save-temps to the command-line that crashes the compiler.  The
preprocessed source will be named wcstol.i
Comment 8 daniel.calcoen 2013-05-10 08:28:52 UTC
Created attachment 30085 [details]
wcstol.i
Comment 9 daniel.calcoen 2013-05-24 16:09:36 UTC
building gcc-4_7-branch instead of gcc-4_8-branch
pass ok
(binutils, GMP, MPFR, MPC, and newlib sources remains the same)
 is some regression introduced in 4.8
Comment 10 Jon Beniston 2013-07-08 15:06:34 UTC
A similar problem is seen in the LM32 port:

http://gcc.gnu.org/ml/gcc/2013-03/msg00317.html

It appeared for that in GCC 4.8.0 and is still in GCC 4.8.1.
Comment 11 Jon Beniston 2013-07-08 15:45:44 UTC
Adding Nick Clifton to the CC list.

It seems the bug was known about a while back:

http://gcc.gnu.org/ml/gcc/2012-10/msg00314.html

Any luck with this Nick?
Comment 12 Jon Beniston 2013-07-08 16:06:29 UTC
This looks like it might be similar to bug 57636, which has the same ICE on the cr16 port.

Suggestion there is that it was introduced in trunk@188870:
2012-06-21  Alexandre Oliva  <aoliva@redhat.com>

        PR debug/53671
        PR debug/49888
        * var-tracking.c (vt_initialize): Record initial offset between
        arg pointer and stack pointer.
Comment 13 Jon Beniston 2013-07-08 19:29:49 UTC
Hi Alexandre, I've added you to this bug as it seems to have been caused by this patch you made:

http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/var-tracking.c?r1=188869&r2=188870

I've got no idea what this code does, but if I removed it, the ICE disappears on LM32. If you think it is a backend problem, rather than this code, it would be helpful if you could give some guidance as to what needs changing, as it seems three targets currently have this problem. Thanks.
Comment 14 Sebastian Götte 2014-02-16 14:49:42 UTC
I am getting the exact same problem trying to cross-compile rx-elf-gcc 4.8.2 with gcc 4.8.2 on my x86_64 archlinux.
Comment 15 Alexandre Oliva 2014-02-19 09:56:39 UTC
Mine.  It looks like the call to cselib_preserve_cfa_base_value in vt_initialize should be guarded by some conditions, like this:

      if (reg != hard_frame_pointer_rtx && fixed_regs[REGNO (reg)])
	cselib_preserve_cfa_base_value (val, REGNO (reg));

This fixes the reported problem for me (though I haven't otherwise regtested it).  Daniel, Jon, Nick, Sebastian, does it fix the problem for you?
Comment 16 Sebastian Götte 2014-02-19 15:28:13 UTC
Alexandre, curiously, applying this patch to the cross-compiler source tree fixes the problem for me building 4.8.2 for rx-elf using a 4.8.2 x86_64 host gcc. I did not even have to rebuild the host gcc.
Comment 17 Nick Clifton 2014-02-19 15:33:07 UTC
Hi Alex,

>       if (reg != hard_frame_pointer_rtx && fixed_regs[REGNO (reg)])
>      cselib_preserve_cfa_base_value (val, REGNO (reg));

This works for the RX port - thanks!

Cheers
   Nick
Comment 18 Jon Beniston 2014-02-26 16:08:45 UTC
Thanks, this seems to fix the LM32 port.
Comment 19 Alexandre Oliva 2014-02-27 05:10:45 UTC
Adjusting component before posting patch to gcc-patches.
Comment 20 Alexandre Oliva 2014-02-28 12:46:08 UTC
Author: aoliva
Date: Fri Feb 28 12:45:36 2014
New Revision: 208219

URL: http://gcc.gnu.org/viewcvs?rev=208219&root=gcc&view=rev
Log:
PR debug/57232
* var-tracking.c (vt_initialize): Apply the same condition to
preserve the CFA base value.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/var-tracking.c
Comment 21 Alexandre Oliva 2014-02-28 13:01:54 UTC
Fixed