public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/57896] [4.8 Regression] ICE in expand_expr_real_2
Date: Thu, 20 Feb 2014 09:29:00 -0000	[thread overview]
Message-ID: <bug-57896-4-RyNHF5Klvi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57896-4@http.gcc.gnu.org/bugzilla/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5267 bytes --]

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

--- Comment #16 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #15)
> I'll have a look (unless you want to continue poking).

According to ChangeLogs, you have much more experience in this part, so I would
be much grateful if you can take it from here.
>From gcc-bugs-return-444318-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Feb 20 09:29:06 2014
Return-Path: <gcc-bugs-return-444318-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15495 invoked by alias); 20 Feb 2014 09:29:06 -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 15470 invoked by uid 48); 20 Feb 2014 09:29:02 -0000
From: "vogt at linux dot vnet.ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug go/60288] New: gccgo crashes compiling '*func_ptr(0)'
Date: Thu, 20 Feb 2014 09:29:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: go
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vogt at linux dot vnet.ibm.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ian at airs dot com
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-60288-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/msg02075.txt.bz2
Content-length: 3074

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`288

            Bug ID: 60288
           Summary: gccgo crashes compiling '*func_ptr(0)'
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: vogt at linux dot vnet.ibm.com

Created attachment 32179
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2179&actioníit
test program

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207936
138bc75d-0d04-0410-961f-82ee72b054a4

This program crashes gcc:

-- BEGIN
package main
func f(i int) int { return i }
func main() {
    g := f
    println(*&g(0))  // <-- compiles (see below)
    pg := &g
    println(*pg(0))  // <-- crash
}
-- END

Instead of producing an error message, gccgo crashes in line 7:

-- snip --
foo.go:7:11: error: expected function
  println(*pg(0))
           ^
go1: internal compiler error: in do_flatten, at
go/gofrontend/expressions.cc:3835
0x80151dc9 Unary_expression::do_flatten(Gogo*, Named_object*,
Statement_inserter*)
    ../../gcc/go/gofrontend/expressions.cc:3835
0x80196583 Expression::flatten(Gogo*, Named_object*, Statement_inserter*)
    ../../gcc/go/gofrontend/expressions.h:635
0x80196583 Flatten::expression(Expression**)
    ../../gcc/go/gofrontend/gogo.cc:2841
0x80152a75 Expression::traverse(Expression**, Traverse*)
    ../../gcc/go/gofrontend/expressions.cc:54
0x80152a75 Expression_list::traverse(Traverse*)
    ../../gcc/go/gofrontend/expressions.cc:15187
0x80152a75 Call_expression::do_traverse(Traverse*)
    ../../gcc/go/gofrontend/expressions.cc:9124
0x80152a75 Call_expression::do_traverse(Traverse*)
    ../../gcc/go/gofrontend/expressions.cc:9118
0x801965a3 Flatten::expression(Expression**)
    ../../gcc/go/gofrontend/gogo.cc:2837
0x80154d67 Expression::traverse(Expression**, Traverse*)
    ../../gcc/go/gofrontend/expressions.cc:54
0x80198ddf Flatten::statement(Block*, unsigned long*, Statement*)
    ../../gcc/go/gofrontend/gogo.cc:2797
0x801da0b3 Statement::traverse(Block*, unsigned long*, Traverse*)
    ../../gcc/go/gofrontend/statements.cc:43
0x8019c791 Block::traverse(Traverse*)
    ../../gcc/go/gofrontend/gogo.cc:4279
0x8019cca3 Function::traverse(Traverse*)
    ../../gcc/go/gofrontend/gogo.cc:3805
0x8019cca3 Flatten::function(Named_object*)
    ../../gcc/go/gofrontend/gogo.cc:2774
0x8019d071 Bindings::traverse(Traverse*, bool)
    ../../gcc/go/gofrontend/gogo.cc:5877
0x8019d81d Gogo::traverse(Traverse*)
    ../../gcc/go/gofrontend/gogo.cc:1466
0x8019d81d Gogo::flatten()
    ../../gcc/go/gofrontend/gogo.cc:2875
0x8018bb8d go_parse_input_files(char const**, unsigned int, bool, bool)
    ../../gcc/go/gofrontend/go.cc:126
-- snip --

As a side note, gccgo compiles line 5 without even as much as a
warning while golang treats this as an error:

  (golang) ./foo.go:5: cannot take the address of g(0)

So it looks like gccgo reads the expression as

  (*pg)(0)

while golang reads it as

  *(pg(0))

Not sure whether this is a bug in gccgo.


  parent reply	other threads:[~2014-02-20  9:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15  6:44 [Bug c/57896] New: ICE in " zeccav at gmail dot com
2013-07-15  9:37 ` [Bug c/57896] " mikpe at it dot uu.se
2013-07-15 14:23 ` mikpe at it dot uu.se
2013-07-15 15:32 ` glisse at gcc dot gnu.org
2013-07-15 16:32 ` glisse at gcc dot gnu.org
2013-07-15 23:42 ` zeccav at gmail dot com
2013-07-16  6:19 ` zeccav at gmail dot com
2014-02-19  8:11 ` [Bug c/57896] [4.8 Regression] ICE " mpolacek at gcc dot gnu.org
2014-02-19 17:59 ` [Bug target/57896] " ubizjak at gmail dot com
2014-02-19 18:06 ` ubizjak at gmail dot com
2014-02-19 18:34 ` ubizjak at gmail dot com
2014-02-19 18:37 ` [Bug middle-end/57896] " ubizjak at gmail dot com
2014-02-19 19:19 ` mpolacek at gcc dot gnu.org
2014-02-20  9:29 ` ubizjak at gmail dot com [this message]
2014-02-20  9:58 ` ubizjak at gmail dot com
2014-02-20 10:15 ` ubizjak at gmail dot com
2014-02-20 10:27 ` [Bug target/57896] " jakub at gcc dot gnu.org
2014-02-20 10:41 ` jakub at gcc dot gnu.org
2014-02-20 10:45 ` ubizjak at gmail dot com
2014-02-20 10:57 ` jakub at gcc dot gnu.org
2014-02-20 11:01 ` ubizjak at gmail dot com
2014-02-20 11:07 ` [Bug target/57896] [4.7/4.8/4.9 " ubizjak at gmail dot com
2014-02-20 11:42 ` jakub at gcc dot gnu.org
2014-02-20 12:00 ` jakub at gcc dot gnu.org
2014-02-20 12:09 ` ubizjak at gmail dot com
2014-02-20 13:00 ` jakub at gcc dot gnu.org
2014-02-20 13:12 ` ubizjak at gmail dot com
2014-02-20 17:25 ` ubizjak at gmail dot com
2014-02-20 20:40 ` jakub at gcc dot gnu.org
2014-02-20 20:41 ` jakub at gcc dot gnu.org
2014-02-20 20:42 ` [Bug target/57896] [4.7 " jakub at gcc dot gnu.org
2014-02-21  7:56 ` uros at gcc dot gnu.org
2014-02-21  8:01 ` ubizjak at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-57896-4-RyNHF5Klvi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).