g++ sucks: internal compiler error???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil Zanella

    g++ sucks: internal compiler error???

    Hello,

    Allow me to share my frustrations with GNU g++. This is the second
    time something similar happens to me: I can't find anything wrong with
    my C++ program and yet I get segfaults, and eventually, here is what
    happens. Anyone ever experience anything similar. This or similar
    untrackable problems happen to me whenever I write a large class...
    anyone have had similar experiences???

    make
    g++ -c matrix.cpp -Wall -g
    matrix.cpp: In member function `void
    Matrix::compute DistShortest(bo ol)':
    matrix.cpp:189: internal compiler error: in find_function_d ata, at
    function.c:
    313
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <URL:http://bugzilla.redhat .com/bugzilla> for instructions.
    Preprocessed source stored into /tmp/ccf7vSby.out file, please attach
    this to your bugreport
    make: *** [matrix.o] Error 1
  • Jonathan Turkanis

    #2
    Re: g++ sucks: internal compiler error???

    "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
    news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...[color=blue]
    > Hello,
    >
    > Allow me to share my frustrations with GNU g++. This is the second
    > time something similar happens to me: I can't find anything wrong[/color]
    with[color=blue]
    > my C++ program and yet I get segfaults, and eventually, here is what
    > happens. Anyone ever experience anything similar. This or similar
    > untrackable problems happen to me whenever I write a large class...
    > anyone have had similar experiences???
    >[/color]

    1. Post a code sample.
    2. say what version of g++ you are using.

    All compilers occasionally give internal errors. If you are using a
    recent version, it is likely that there is an error in your code which
    g++ doesn't know how to diagnose. Try compiling on at least one other
    compiler. When you find out what's tripping up g++, you, or someone in
    this group, can probably find a workaround.

    Jonathan


    Comment

    • John Harrison

      #3
      Re: g++ sucks: internal compiler error???


      "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
      news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...[color=blue]
      > Hello,
      >
      > Allow me to share my frustrations with GNU g++. This is the second
      > time something similar happens to me: I can't find anything wrong with
      > my C++ program and yet I get segfaults[/color]

      Almost certainly bugs in your program. g++ isn't bug free of course, but it
      isn't a buggy program either.

      What is it they say about tools and bad workmen?
      [color=blue]
      >, and eventually, here is what
      > happens. Anyone ever experience anything similar. This or similar
      > untrackable problems happen to me whenever I write a large class...[/color]

      Write smaller classes.
      [color=blue]
      > anyone have had similar experiences???
      >[/color]

      Only on a different compiler. On that compiler an internal compiler error
      almost always indicated a syntax error in some complex language construct.
      In your case I would guess some syntax error in an extremely large class
      might be the cause.
      [color=blue]
      > make
      > g++ -c matrix.cpp -Wall -g
      > matrix.cpp: In member function `void
      > Matrix::compute DistShortest(bo ol)':
      > matrix.cpp:189: internal compiler error: in find_function_d ata, at
      > function.c:
      > 313[/color]

      Why not share the code. No-one can offer any useful help without it. Before
      posting the code however, take the time to cut out the parts that are not
      contributing to the error. This sort of methodical approach might help you
      figure out the cause of the error in which case you would have learned
      something valuable, if it doesn't then you at least will be posting less
      code here and are more likely to get help.

      john


      Comment

      • Jonathan Turkanis

        #4
        Re: g++ sucks: internal compiler error???


        "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
        news:c4j39p$2jc 21m$1@ID-216073.news.uni-berlin.de...[color=blue]
        > "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
        > news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...[color=green]
        > > Hello,[/color][/color]
        [color=blue]
        > compiler. When you find out what's tripping up g++, you, or someone[/color]
        in[color=blue]
        > this group, can probably find a workaround.[/color]

        I mean IF it turns out to be a real problems with g++, and not with
        your code.

        Jonathan


        Comment

        • Fred Ma

          #5
          Re: g++ sucks: internal compiler error???

          Neil Zanella wrote:[color=blue]
          >
          > Hello,
          >
          > Allow me to share my frustrations with GNU g++. This is the second
          > time something similar happens to me: I can't find anything wrong with
          > my C++ program and yet I get segfaults, and eventually, here is what
          > happens. Anyone ever experience anything similar. This or similar
          > untrackable problems happen to me whenever I write a large class...
          > anyone have had similar experiences???
          >
          > make
          > g++ -c matrix.cpp -Wall -g
          > matrix.cpp: In member function `void
          > Matrix::compute DistShortest(bo ol)':
          > matrix.cpp:189: internal compiler error: in find_function_d ata, at
          > function.c:
          > 313
          > Please submit a full bug report,
          > with preprocessed source if appropriate.
          > See <URL:http://bugzilla.redhat .com/bugzilla> for instructions.
          > Preprocessed source stored into /tmp/ccf7vSby.out file, please attach
          > this to your bugreport
          > make: *** [matrix.o] Error 1[/color]


          Hey, Neil,

          Do a web search on netiquette, especially for usenet.
          You might be extremely frustrated, but to say that
          g++ sucks when it is a free compiler that serves
          many people well is not the best way to present
          yourself to the world. Sorry, I don't have an
          answer to your problem, but I'm trying to help
          out by helping you post in a way that might get
          more people to help.

          Fred
          --
          Fred Ma
          Dept. of Electronics, Carleton University
          1125 Colonel By Drive, Ottawa, Ontario
          Canada, K1S 5B6

          Comment

          • P.J. Plauger

            #6
            Re: g++ sucks: internal compiler error???

            "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
            news:c4j3f7$2dp hq9$1@ID-216073.news.uni-berlin.de...
            [color=blue]
            > "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
            > news:c4j39p$2jc 21m$1@ID-216073.news.uni-berlin.de...[color=green]
            > > "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
            > > news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...[color=darkred]
            > > > Hello,[/color][/color]
            >[color=green]
            > > compiler. When you find out what's tripping up g++, you, or someone[/color]
            > in[color=green]
            > > this group, can probably find a workaround.[/color]
            >
            > I mean IF it turns out to be a real problems with g++, and not with
            > your code.[/color]

            An internal compiler error is *always* a real problem with the
            compiler, not with user code. Perhaps the compiler is just a
            sucker for a syntax error, but that still makes it a sucker.

            P.J. Plauger
            Dinkumware, Ltd.



            Comment

            • Rolf Magnus

              #7
              Re: g++ sucks: internal compiler error???

              Neil Zanella wrote:
              [color=blue]
              > Hello,
              >
              > Allow me to share my frustrations with GNU g++.[/color]

              Why don't you do that in gnu.g++.help?
              [color=blue]
              > This is the second time something similar happens to me: I can't find
              > anything wrong with my C++ program and yet I get segfaults, and
              > eventually, here is what happens. Anyone ever experience anything
              > similar. This or similar untrackable problems happen to me whenever I
              > write a large class...
              > anyone have had similar experiences???[/color]

              Until now only with "gcc" 2.96, which is not a gcc release, but rather
              an infamous fork by RedHat. The early versions of this one gave me real
              headaches, crashing often.
              [color=blue]
              > make
              > g++ -c matrix.cpp -Wall -g
              > matrix.cpp: In member function `void
              > Matrix::compute DistShortest(bo ol)':
              > matrix.cpp:189: internal compiler error: in find_function_d ata, at
              > function.c:
              > 313
              > Please submit a full bug report,
              > with preprocessed source if appropriate.
              > See <URL:http://bugzilla.redhat .com/bugzilla> for instructions.
              > Preprocessed source stored into /tmp/ccf7vSby.out file, please attach
              > this to your bugreport
              > make: *** [matrix.o] Error 1[/color]

              And now what? You discovered a bug. Compilers, just like all programs,
              are not perfect. Did you consider reporting the bug?

              Comment

              • Jacek Dziedzic

                #8
                Re: g++ sucks: internal compiler error???

                P.J. Plauger wrote:
                [color=blue]
                > An internal compiler error is *always* a real problem with the
                > compiler, not with user code.[/color]

                Well, the OP wrote that he gets segfaults and *eventually*
                the compiler gives him the internal error. If the segfaults
                are *his* program crashing, he might well have undefined
                behaviour by then, which obviously includes having all
                subsequent compilatons fail due to mystical internal errors.

                Just a possibility, of course.

                - J.

                Comment

                • Nils Petter Vaskinn

                  #9
                  Re: g++ sucks: internal compiler error???

                  On Thu, 01 Apr 2004 22:49:47 -0800, Neil Zanella wrote:

                  OT in c.l.c++ Crossposted and followups set. Leaving all of the original
                  message for the benefit of the people in gnu.g++.help
                  [color=blue]
                  > Hello,
                  >
                  > Allow me to share my frustrations with GNU g++. This is the second
                  > time something similar happens to me: I can't find anything wrong with
                  > my C++ program and yet I get segfaults, and eventually, here is what
                  > happens. Anyone ever experience anything similar. This or similar
                  > untrackable problems happen to me whenever I write a large class...
                  > anyone have had similar experiences???
                  >
                  > make
                  > g++ -c matrix.cpp -Wall -g
                  > matrix.cpp: In member function `void
                  > Matrix::compute DistShortest(bo ol)':
                  > matrix.cpp:189: internal compiler error: in find_function_d ata, at
                  > function.c:
                  > 313
                  > Please submit a full bug report,
                  > with preprocessed source if appropriate.
                  > See <URL:http://bugzilla.redhat .com/bugzilla> for instructions.
                  > Preprocessed source stored into /tmp/ccf7vSby.out file, please attach
                  > this to your bugreport
                  > make: *** [matrix.o] Error 1[/color]

                  Is the error always at the same place? If yes submit a bug report (after
                  having searched known bugs) if you can make a minimal example that shows
                  the problem I'm sure the gcc guys will appreciate it.

                  If the error happens at different places when compiling identical code I'd
                  also run checks on the hardware. (eg memcheck86 (correct name?)).
                  Compilation is pretty heavy on the machine and if you have dodgy memory,
                  dodgy cpu (overheating?) or other problems that's when they are most
                  likely to show up.

                  --
                  NPV

                  "the large print giveth, and the small print taketh away"
                  Tom Waits - Step right up

                  Comment

                  • P.J. Plauger

                    #10
                    Re: g++ sucks: internal compiler error???

                    "Jacek Dziedzic" <jacek__NOSPAM_ _@janowo.net> wrote in message
                    news:c4jc94$fgq $2@korweta.task .gda.pl...
                    [color=blue]
                    > P.J. Plauger wrote:
                    >[color=green]
                    > > An internal compiler error is *always* a real problem with the
                    > > compiler, not with user code.[/color]
                    >
                    > Well, the OP wrote that he gets segfaults and *eventually*
                    > the compiler gives him the internal error. If the segfaults
                    > are *his* program crashing, he might well have undefined
                    > behaviour by then, which obviously includes having all
                    > subsequent compilatons fail due to mystical internal errors.
                    >
                    > Just a possibility, of course.[/color]

                    Uh, we're talking compile time, long before his program runs.
                    If the segfaults are *the compiler* crashing, that's a real
                    problem with the compiler, not with user code. It's a problem
                    even worse than an ICE.

                    Why all this effort to apologize for a compiler bug? I've
                    seen them in all compilers, from time to time. Some compilers
                    crash more often than others, but all do so. Nothing alters
                    the fact that a compiler is obliged to survive any kind of
                    input, without crashing and without reporting an internal
                    compiler error.

                    P.J. Plauger
                    Dinkumware, Ltd.



                    Comment

                    • Jeff Schwab

                      #11
                      Re: g++ sucks: internal compiler error???

                      [color=blue]
                      > An internal compiler error is *always* a real problem with the
                      > compiler, not with user code. Perhaps the compiler is just a
                      > sucker for a syntax error, but that still makes it a sucker.
                      >
                      > P.J. Plauger
                      > Dinkumware, Ltd.
                      > http://www.dinkumware.com[/color]


                      Thank you.

                      Comment

                      • Leor Zolman

                        #12
                        Re: g++ sucks: internal compiler error???

                        On Fri, 02 Apr 2004 08:27:25 GMT, "P.J. Plauger" <pjp@dinkumware .com>
                        wrote:
                        [color=blue]
                        >"Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                        >news:c4j3f7$2d phq9$1@ID-216073.news.uni-berlin.de...
                        >[color=green]
                        >> "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                        >> news:c4j39p$2jc 21m$1@ID-216073.news.uni-berlin.de...[color=darkred]
                        >> > "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
                        >> > news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...
                        >> > > Hello,[/color]
                        >>[color=darkred]
                        >> > compiler. When you find out what's tripping up g++, you, or someone[/color]
                        >> in[color=darkred]
                        >> > this group, can probably find a workaround.[/color]
                        >>
                        >> I mean IF it turns out to be a real problems with g++, and not with
                        >> your code.[/color]
                        >
                        >An internal compiler error is *always* a real problem with the
                        >compiler, not with user code. Perhaps the compiler is just a
                        >sucker for a syntax error, but that still makes it a sucker.
                        >
                        >P.J. Plauger
                        >Dinkumware, Ltd.
                        >http://www.dinkumware.com[/color]

                        Of course, but I get the feeling the poster was trying to say that
                        erroneous code can "help" a buggy compiler to manifest its bugginess (as I
                        have no doubt you knew). Sometimes that compiler bugginess can work in a
                        user's favor (although not in this case, since gcc is free...)

                        When I was working at CUJ, we used a relatively early version of the
                        Informix 4GL compiler for SCO Xenix. It was the buggiest compiler I've ever
                        used, just dumping core left and right when it came across common syntax
                        errors, and Informix wasn't bothering to fix it because Xenix was fading
                        into oblivion (although it sure rocked in its day...) So we bitched and
                        moaned to Informix until, to shut us up, they sent us a free copy of their
                        debugger-equipped interpretive 4GL system, just so we'd have something
                        that could diagnose the syntax errors in the code! Once we fixed those
                        errors, the compiler had a lot less indigestion. And we got a nice debugger
                        out of it that we couldn't have had otherwise without purchasing that other
                        package ;-)
                        -leor

                        --
                        Leor Zolman --- BD Software --- www.bdsoft.com
                        On-Site Training in C/C++, Java, Perl and Unix
                        C++ users: Download BD Software's free STL Error Message Decryptor at:
                        An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

                        Comment

                        • Jonathan Turkanis

                          #13
                          Re: g++ sucks: internal compiler error???


                          "P.J. Plauger" <pjp@dinkumware .com> wrote in message
                          news:Nt9bc.1685 1$BE3.14231@nwr ddc03.gnilink.n et...[color=blue]
                          > "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                          > news:c4j3f7$2dp hq9$1@ID-216073.news.uni-berlin.de...
                          >[color=green]
                          > > "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                          > > news:c4j39p$2jc 21m$1@ID-216073.news.uni-berlin.de...[color=darkred]
                          > > > "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
                          > > > news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...
                          > > > > Hello,[/color]
                          > >[color=darkred]
                          > > > compiler. When you find out what's tripping up g++, you, or[/color][/color][/color]
                          someone[color=blue][color=green]
                          > > in[color=darkred]
                          > > > this group, can probably find a workaround.[/color]
                          > >
                          > > I mean IF it turns out to be a real problems with g++, and not[/color][/color]
                          with[color=blue][color=green]
                          > > your code.[/color]
                          >
                          > An internal compiler error is *always* a real problem with the
                          > compiler, not with user code. Perhaps the compiler is just a
                          > sucker for a syntax error, but that still makes it a sucker.
                          >[/color]

                          Yes, I think that's clear. I didn't mean to imply otherwise.

                          I realized that I might have lest the impression with my first post
                          that a workaround would be needed if the code contained an error,
                          which when corrected, allowed the code to compile successfully.

                          Jonathan


                          Comment

                          • Jonathan Turkanis

                            #14
                            Re: g++ sucks: internal compiler error???


                            "Leor Zolman" <leor@bdsoft.co m> wrote in message
                            news:j12r60dqdo t0tt4p93l5oto1v be3nluff1@4ax.c om...[color=blue]
                            > On Fri, 02 Apr 2004 08:27:25 GMT, "P.J. Plauger"[/color]
                            <pjp@dinkumware .com>[color=blue]
                            > wrote:
                            >[color=green]
                            > >"Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                            > >news:c4j3f7$2d phq9$1@ID-216073.news.uni-berlin.de...
                            > >[color=darkred]
                            > >> "Jonathan Turkanis" <technews@kanga roologic.com> wrote in message
                            > >> news:c4j39p$2jc 21m$1@ID-216073.news.uni-berlin.de...
                            > >> > "Neil Zanella" <nzanella@cs.mu n.ca> wrote in message
                            > >> > news:b68d2f19.0 404012249.2f08f 7df@posting.goo gle.com...
                            > >> > > Hello,
                            > >>
                            > >> > compiler. When you find out what's tripping up g++, you, or[/color][/color][/color]
                            someone[color=blue][color=green][color=darkred]
                            > >> in
                            > >> > this group, can probably find a workaround.
                            > >>
                            > >> I mean IF it turns out to be a real problems with g++, and not[/color][/color][/color]
                            with[color=blue][color=green][color=darkred]
                            > >> your code.[/color]
                            > >
                            > >An internal compiler error is *always* a real problem with the
                            > >compiler, not with user code. Perhaps the compiler is just a
                            > >sucker for a syntax error, but that still makes it a sucker.
                            > >
                            > >P.J. Plauger
                            > >Dinkumware, Ltd.
                            > >http://www.dinkumware.com[/color]
                            >
                            > Of course, but I get the feeling the poster was trying to say that
                            > erroneous code can "help" a buggy compiler to manifest its bugginess[/color]
                            (as I[color=blue]
                            > have no doubt you knew). Sometimes that compiler bugginess can work[/color]
                            in a[color=blue]
                            > user's favor (although not in this case, since gcc is free...)[/color]

                            I guess I wasn't very clear. I was just trying to make what I thought
                            was an obvious point, but might not be to someone who has never seen
                            an internal compiler error: the internal error, which is clearly a
                            problem with the compiler, usually goes away when an error is
                            corrected. The error can often be spotted by using a second or third
                            compiler. If the code turns out to be correct, there is usually a way
                            to rewrite the code so that the compiler will accept it.

                            I've never had an ICE on GCC that didn't represent a problem with my
                            code. VC6, on the other hand, gives me ICEs all the time with
                            perfectly correct code, even when I use the standard workarounds.

                            Jonathan


                            Comment

                            • Claudio Puviani

                              #15
                              Re: g++ sucks: internal compiler error???

                              "Jonathan Turkanis" <technews@kanga roologic.com> wrote[color=blue]
                              > I've never had an ICE on GCC that didn't represent a problem with my
                              > code. VC6, on the other hand, gives me ICEs all the time with
                              > perfectly correct code, even when I use the standard workarounds.[/color]

                              I'd be careful making up abbreviations. An ICE is an in-circuit emulator,
                              not an internal compiler error. :-)

                              Claudio Puviani


                              Comment

                              Working...