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



             Bug #: 56113

           Summary: out of memory when compiling a function with many goto

                    labels (50k > )

    Classification: Unclassified

           Product: gcc

           Version: 4.6.3

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: aixe...@gmail.com





Out of memory when compiling a function with many goto labels (50k > )



gcc 4.6.3 compiler(running on top of ubuntu 12.04 32-bit) failed to output an

object for a function when it comes with extremely large number of goto

labels.



Attached is a simple script that generates the test source file. Here's how to

reproduce a failure with the script.



~$./goto_gen.py 60000 t.c



~$ time cc -O1 -o t t.c



cc1: out of memory allocating 4064 bytes after a total of 2309808128 bytes



real    11m44.371s

user    11m42.592s

sys    0m1.876s



~$ time cc -O0 -o t t.c



real    22m5.106s

user    22m3.539s

sys    0m1.640s





As you can see from the above, -O1 option trigger the problem while -O0

doesn't.



Could you anyone tell me how to workaround this situation? Or which specific

optimization option causes the issue?



Thanks a lot for your help in advance.



Regards, Kangkook

Reply via email to