Bug 60870 - go interface methods broken on ppc64le (bug296.go)
Summary: go interface methods broken on ppc64le (bug296.go)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: go (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-17 05:27 UTC by Anton Blanchard
Modified: 2014-04-17 19:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-04-17 00:00:00


Attachments
possible patch (541 bytes, patch)
2014-04-17 16:37 UTC, Ian Lance Taylor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Blanchard 2014-04-17 05:27:28 UTC
bug296.go is failing on a checkout from today.

The caller is putting the 9th argument in r1+32 instead of r1+96 where we expect:

   0x000000001000195c <+140>:	std     r27,32(r1) <-----
   0x0000000010001960 <+144>:	li      r10,22
   0x0000000010001964 <+148>:	std     r2,24(r1)
   0x0000000010001968 <+152>:	addi    r31,r31,1
   0x000000001000196c <+156>:	mtctr   r11

The failure bisected to:

2c809f8f2584460a5207662cc8e064486cb0ec30 (Sync to current external repository)
Comment 1 Anton Blanchard 2014-04-17 07:19:07 UTC
I just realised I gave a git commit id from the mirror. The ChangeLog entry is:

+2014-04-14  Chris Manghane  <cmang@google.com>
+
+       * go-gcc.cc: Include "convert.h".
+       (Gcc_backend::string_constant_expression): New function.
+       (Gcc_backend::real_part_expression): Likewise.
+       (Gcc_backend::imag_part_expression): Likewise.
+       (Gcc_backend::complex_expression): Likewise.
+       (Gcc_backend::constructor_expression): Likewise.
+       (Gcc_backend::array_constructor_expression): Likewise.
+       (Gcc_backend::pointer_offset_expression): Likewise.
+       (Gcc_backend::array_index_expression): Likewise.
+       (Gcc_backend::call_expression): Likewise.
+       (Gcc_backend::exception_handler_statement): Likewise.
+       (Gcc_backend::function_defer_statement): Likewise.
+       (Gcc_backend::function_set_parameters): Likewise.
+       (Gcc_backend::function_set_body): Likewise.
+       (Gcc_backend::convert_expression): Handle various type
+       conversions.
Comment 2 Ulrich Weigand 2014-04-17 10:42:41 UTC
Confirmed.

This commit seems to have reverted the effects of the bug fix here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02994.html
Comment 3 Ian Lance Taylor 2014-04-17 16:37:51 UTC
Created attachment 32626 [details]
possible patch
Comment 4 Ian Lance Taylor 2014-04-17 16:38:30 UTC
I don't have a PPC system.  Can you see if the attached patch to gcc/go/gofrontend/expressions.cc fixes the problem?
Comment 5 Ulrich Weigand 2014-04-17 19:04:11 UTC
(In reply to Ian Lance Taylor from comment #4)
> I don't have a PPC system.  Can you see if the attached patch to
> gcc/go/gofrontend/expressions.cc fixes the problem?

Yes, this makes bug296.go PASS again on powerpc64le.

Thanks for the quick fix!
Comment 6 ian@gcc.gnu.org 2014-04-17 19:27:54 UTC
Author: ian
Date: Thu Apr 17 19:27:22 2014
New Revision: 209494

URL: http://gcc.gnu.org/viewcvs?rev=209494&root=gcc&view=rev
Log:
	PR go/60870

compiler: Don't convert function type for an interface method.

For an interface method the function type is the type without
the receiver, which is wrong since we are passing a receiver.
The interface method will always have the correct type in this
case, so no type conversion is necessary.

Also don't do the type conversion when calling a named
function, since in that case the type is also always correct.

The type can be wrong, and the conversion required, when the
function type refers to itself recursively.

Modified:
    trunk/gcc/go/gofrontend/expressions.cc
Comment 7 Ian Lance Taylor 2014-04-17 19:28:31 UTC
Fixed.