public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Philip Herron <philip.herron@embecosm.com>
Cc: gcc-rust@gcc.gnu.org
Subject: Re: debian-i386 target (Was: ppc64le added to buildbot)
Date: Wed, 2 Jun 2021 23:14:25 +0200	[thread overview]
Message-ID: <YLf0scN/w7g5wvPN@wildebeest.org> (raw)
In-Reply-To: <CAB2u+n3pJFuryTDEU5-RHf1AyNVoAsDZhX1b-zmhm7jD+rsf6w@mail.gmail.com>

Hi Philip,

On Wed, Jun 02, 2021 at 11:22:43AM +0100, Philip Herron wrote:
> > Analyzing compilation unit
> > /home/mark/gccrs/gcc/testsuite/rust.test/compile/methods1.rs: In function
> > ‘Rectangle_sum_x’:
> > /home/mark/gccrs/gcc/testsuite/rust.test/compile/methods1.rs:26:5: error:
> > type mismatch in binary expression
> >    26 |     fn sum_x(self) -> f64 {
> >       |     ^
> > f64
> >
> > <float:80>
> >
> > <float:80>
> >
> > D.227 = _2 + _4;
> > /home/mark/gccrs/gcc/testsuite/rust.test/compile/methods1.rs:26:5:
> > internal compiler error: ‘verify_gimple’ failed
> > 0x8b114e4 verify_gimple_in_seq(gimple*)
> >         ../../gccrs/gcc/tree-cfg.c:5157
> > 0x881a9e3 gimplify_body(tree_node*, bool)
> >         ../../gccrs/gcc/gimplify.c:15401
> > 0x881abb2 gimplify_function_tree(tree_node*)
> >         ../../gccrs/gcc/gimplify.c:15472
> > 0x8675c88 cgraph_node::analyze()
> >         ../../gccrs/gcc/cgraphunit.c:670
> > 0x8678a58 analyze_functions
> >         ../../gccrs/gcc/cgraphunit.c:1236
> > 0x8679641 symbol_table::finalize_compilation_unit()
> >         ../../gccrs/gcc/cgraphunit.c:2514
> 
> This is a good find I will open an issue to track this, I have a local
> Debian 32 bit machine at home so I can try this on later in the week. Off
> the top of my head I am wondering if there is something wrong with how we
> are building up the integer tree nodes. The relevant code starts in
> gcc/rust/backend/rust-compile-tyty.h inside ```  void visit (TyTy::IntType
> &type) override```.
> 
> Let me know if you get anywhere with this before Friday since I will should
> be able to look into this issue then.

I looked a bit but am still struggling with how to debug the gimple generation.
The following is a simpler variant that shows the issue:

fn sum(x: f64, y: f64) -> f64
{
  x + y
}

fn main()
{
  let _sum = sum(3.0, 4.0);
}

Interestingly the following, using an mutable temporary variable to hold the result does pass:

fn sum(x: f64, y: f64) -> f64
{
   let mut z:f64 = x;
   z += y;
   z
}

fn main()
{
  let _sum = sum(3.0, 4.0);
}

As far as I can tell the second variant still uses float:80 for the
temporaries, but because z is f64 it gets cast to (f64) when
returning, making the gimple check pass.

So I assumed it was because the arguments got the wrong type somehow.
But the following also doesn't pass:

fn sum(x: f64, y: f64) -> f64
{
   let a:f64 = x;
   let b:f64 = y;
   a + b
}

fn main()
{
  let _sum = sum(3.0, 4.0);
}

So it is as if the plus expression gets its variable types wrong.
I don't know where that is generated though, or why it is using float:80.

Cheers,

Mark


      parent reply	other threads:[~2021-06-02 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 22:31 ppc64le added to buildbot Mark Wielaard
2021-06-01 22:34 ` debian-i386 target (Was: ppc64le added to buildbot) Mark Wielaard
2021-06-02 10:22   ` Philip Herron
2021-06-02 10:25     ` John Paul Adrian Glaubitz
2021-06-02 21:14     ` Mark Wielaard [this message]

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=YLf0scN/w7g5wvPN@wildebeest.org \
    --to=mark@klomp.org \
    --cc=gcc-rust@gcc.gnu.org \
    --cc=philip.herron@embecosm.com \
    /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).