public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60026] New: ICE at -O3 on valid code (with the optimize pragma) on x86_64-linux-gnu
@ 2014-02-02  1:28 su at cs dot ucdavis.edu
  2014-02-03  9:41 ` [Bug ipa/60026] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-02  1:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60026
           Summary: ICE at -O3 on valid code (with the optimize pragma) on
                    x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code using the optimize pragma causes an ICE when compiled with
the current gcc trunk and 4.8.x at -O3 on x86_64-linux-gnu (in both 32-bit and
64-bit modes). 

It is a regression from 4.7.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140131 (experimental) [trunk revision 207368] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.7.3 -O3 small.c; a.out
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘foo.constprop’:
small.c:8:10: internal compiler error: in parm_preserved_before_stmt_p, at
ipa-prop.c:760
 struct S foo (int p1, struct S p2)
          ^
0x84d137 parm_preserved_before_stmt_p
    ../../gcc-trunk/gcc/ipa-prop.c:760
0x84ecb4 ipa_load_from_parm_agg_1
    ../../gcc-trunk/gcc/ipa-prop.c:885
0x8531fa ipcp_transform_function(cgraph_node*)
    ../../gcc-trunk/gcc/ipa-prop.c:4776
0x915260 execute_one_ipa_transform_pass
    ../../gcc-trunk/gcc/passes.c:2066
0x915260 execute_all_ipa_transforms()
    ../../gcc-trunk/gcc/passes.c:2107
0x6a022a expand_function
    ../../gcc-trunk/gcc/cgraphunit.c:1767
0x6a2116 expand_all_functions
    ../../gcc-trunk/gcc/cgraphunit.c:1908
0x6a2116 compile()
    ../../gcc-trunk/gcc/cgraphunit.c:2252
0x6a2994 finalize_compilation_unit()
    ../../gcc-trunk/gcc/cgraphunit.c:2329
0x55c5e2 c_write_global_declarations()
    ../../gcc-trunk/gcc/c/c-decl.c:10401
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.
$ 


------------------------------


struct S
{
  int f;
} a;

#pragma GCC push_options
#pragma GCC optimize ("-O0")
struct S foo (int p1, struct S p2)
{
  int b = p2.f;
  return a; 
}
#pragma GCC pop_options

void
bar ()
{
  for (;a.f;)
    {
      struct S c = {0};
      foo (0, c);
    }
}

int
main ()
{
  bar(); 
  return 0;
}
>From gcc-bugs-return-442301-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 02 02:58:40 2014
Return-Path: <gcc-bugs-return-442301-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22597 invoked by alias); 2 Feb 2014 02:58:39 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22558 invoked by uid 48); 2 Feb 2014 02:58:33 -0000
From: "potswa at mac dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/57350] std::align missing
Date: Sun, 02 Feb 2014 02:58:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: potswa at mac dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57350-4-la5jNUlIyz@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57350-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57350-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg00058.txt.bz2
Content-length: 943

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW350

--- Comment #4 from David Krauss <potswa at mac dot com> ---
Hmm, I recall preparing to submit a patch but not being able to decide which
header to modify.

Here's the aforementioned MIT-licensed code. The MIT license only requires
attribution which is satisfied by the changelog; anyway I don't care. I am
already a GNU contributor with FSF waiver back in 2009.

This code should probably be reviewed. I wrote it a long time ago and seldom
used it. Cannot recall whether it was intended to be 100% compliant.


inline void *align( std::size_t alignment, std::size_t size, void *&ptr,
std::size_t &space ) {
    auto pn = reinterpret_cast< std::size_t >( ptr );
    auto aligned = ( pn + alignment - 1 ) & - alignment;
    auto new_space = space - ( aligned - pn );
    if ( new_space < size ) return nullptr;
    space = new_space;
    return ptr = reinterpret_cast< void * >( aligned );
}


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

end of thread, other threads:[~2014-03-06  8:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-02  1:28 [Bug tree-optimization/60026] New: ICE at -O3 on valid code (with the optimize pragma) on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-02-03  9:41 ` [Bug ipa/60026] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-02-03  9:42 ` [Bug ipa/60026] [4.9 " rguenth at gcc dot gnu.org
2014-02-03 16:57 ` [Bug ipa/60026] [4.8/4.9 " jakub at gcc dot gnu.org
2014-02-03 17:23 ` jakub at gcc dot gnu.org
2014-02-03 18:05 ` jamborm at gcc dot gnu.org
2014-02-03 18:10 ` jakub at gcc dot gnu.org
2014-02-03 18:25 ` jamborm at gcc dot gnu.org
2014-02-03 18:37 ` jakub at gcc dot gnu.org
2014-02-03 18:47 ` jamborm at gcc dot gnu.org
2014-02-04  9:53 ` rguenth at gcc dot gnu.org
2014-02-04 13:05 ` jakub at gcc dot gnu.org
2014-02-04 13:06 ` [Bug ipa/60026] [4.8 " jakub at gcc dot gnu.org
2014-02-07 23:54 ` jakub at gcc dot gnu.org
2014-03-06  7:57 ` jakub at gcc dot gnu.org
2014-03-06  8:26 ` jakub 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).