public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51949] New: expand_call: seg fault
@ 2012-01-22 18:23 dcb314 at hotmail dot com
  2012-01-22 21:57 ` [Bug middle-end/51949] [4.7 Regression] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2012-01-22 18:23 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51949
           Summary: expand_call: seg fault
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dcb314@hotmail.com


Created attachment 26413
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26413
C source code

I just tried to compile the package schismtracker-20110101-1
on latest trunk dated 20120122 on an AMD x86_64 box.

The compiler said

schism/util.c: In function 'str_dup':
schism/util.c:70:7: 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.

valgrind says
==17275== Invalid read of size 1
==17275==    at 0x5E5908: expand_call(tree_node*, rtx_def*, int) (calls.c:3146)
==17275==    by 0x6D8F09: expand_expr_real_1(tree_node*, rtx_def*,
machine_mode, expand_modifier, rtx_def**) (expr.c:9922)
==17275==    by 0x5F833E: expand_gimple_stmt(gimple_statement_d*)
(cfgexpand.c:2094)
==17275==    by 0x5F92B8: expand_gimple_basic_block(basic_block_def*)
(cfgexpand.c:4034)
==17275==    by 0x5FAF1B: gimple_expand_cfg() (cfgexpand.c:4542)
==17275==    by 0x88618C: execute_one_pass(opt_pass*) (passes.c:2081)
==17275==    by 0x8866A6: execute_pass_list(opt_pass*) (passes.c:2136)
==17275==    by 0x9C4B6D: tree_rest_of_compilation(tree_node*)
(tree-optimize.c:420)
==17275==    by 0x61EB3D: cgraph_expand_function(cgraph_node*)
(cgraphunit.c:1818)
==17275==    by 0x62276B: cgraph_optimize() (cgraphunit.c:1885)
==17275==    by 0x622E19: cgraph_finalize_compilation_unit()
(cgraphunit.c:1327)
==17275==    by 0x4F4F86: c_write_global_declarations() (c-decl.c:10030)
==17275==  Address 0x2 is not stack'd, malloc'd or (recently) free'd
==17275==

Preprocessed source code attached. Flag -O3 required.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
@ 2012-01-22 21:57 ` pinskia at gcc dot gnu.org
  2012-01-22 22:00 ` [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-22 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-22
   Target Milestone|---                         |4.7.0
            Summary|expand_call: seg fault      |[4.7 Regression]
                   |                            |expand_call: seg fault
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-22 21:19:04 UTC ---
Reduced testcase:
typedef long unsigned int size_t;
extern __attribute__ ((malloc)) void *mem_alloc(size_t);
void *mem_alloc(size_t amount)
{
        void *q = __builtin_malloc (amount);
        if (!q) {
                __builtin_printf("malloc");
                __builtin_exit(255);
        }
}
void mem_realloc()
{
 mem_alloc(1);
}
void put_env_var()
{
 mem_alloc(1);
}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
  2012-01-22 21:57 ` [Bug middle-end/51949] [4.7 Regression] " pinskia at gcc dot gnu.org
@ 2012-01-22 22:00 ` pinskia at gcc dot gnu.org
  2012-01-23 10:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-22 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.7 Regression]            |[4.7 Regression]
                   |expand_call: seg fault      |expand_call: seg fault
                   |                            |caused by IPA split

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-22 21:24:56 UTC ---
The problem is IPA split is splitting the function mem_alloc correctly, though
it should have removed the malloc attribute on the split function.
This was introduced by:
2012-01-11  Eric Botcazou  <ebotcazou@adacore.com>

...
        * ipa-split.c (split_function): Skip the return value for the split
        part if it doesn't return.

Though it was always there really.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
  2012-01-22 21:57 ` [Bug middle-end/51949] [4.7 Regression] " pinskia at gcc dot gnu.org
  2012-01-22 22:00 ` [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split pinskia at gcc dot gnu.org
@ 2012-01-23 10:47 ` rguenth at gcc dot gnu.org
  2012-01-23 10:48 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-23 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:35:26 UTC ---
Mine.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2012-01-23 10:47 ` rguenth at gcc dot gnu.org
@ 2012-01-23 10:48 ` rguenth at gcc dot gnu.org
  2012-01-23 11:09 ` rguenth at gcc dot gnu.org
  2012-01-23 11:19 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-23 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:42:04 UTC ---
We do not honor cur_node->local.can_change_signature, and that does not
take into account return value removal.  I have a smallish workaround.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2012-01-23 10:48 ` rguenth at gcc dot gnu.org
@ 2012-01-23 11:09 ` rguenth at gcc dot gnu.org
  2012-01-23 11:19 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-23 11:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:53:13 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split
  2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2012-01-23 11:09 ` rguenth at gcc dot gnu.org
@ 2012-01-23 11:19 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-23 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:53:01 UTC ---
Author: rguenth
Date: Mon Jan 23 10:52:57 2012
New Revision: 183424

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183424
Log:
2012-01-23  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/51949
    * ipa-split.c (execute_split_functions): Do not split malloc
    functions.

    * gcc.dg/torture/pr51949.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr51949.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-split.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-01-23 10:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22 18:23 [Bug c/51949] New: expand_call: seg fault dcb314 at hotmail dot com
2012-01-22 21:57 ` [Bug middle-end/51949] [4.7 Regression] " pinskia at gcc dot gnu.org
2012-01-22 22:00 ` [Bug middle-end/51949] [4.7 Regression] expand_call: seg fault caused by IPA split pinskia at gcc dot gnu.org
2012-01-23 10:47 ` rguenth at gcc dot gnu.org
2012-01-23 10:48 ` rguenth at gcc dot gnu.org
2012-01-23 11:09 ` rguenth at gcc dot gnu.org
2012-01-23 11:19 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).