public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65342] [5 Regression] FAIL: gfortran.dg/intrinsic_(un)?pack_1.f90   -O1  execution test on powerpc-apple-darwin9 after r210201
Date: Sat, 07 Mar 2015 16:55:00 -0000	[thread overview]
Message-ID: <bug-65342-4-M2NqYNGpgl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65342-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: 9038 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65342

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #2)
> > Confirmed.  The problem occurs in fwprop1 where instructions corresponding to the
> > following assembly
> >	addis r2,r31,ha16(_A.1.1600-L1$pb)
> >	la r9,lo16(_A.1.1600-L1$pb)(r2)
> >	ld r2,0(r9)
> > are combined to
> >	addis r2,r31,ha16(_A.1.1600-L1$pb)
> >	la r9,lo16(_A.1.1600-L1$pb)(r2)
> >	ld r2,lo16(_A.1.1600-L1$pb)(r2)
> > ie. the offset is propagated into the memory load.  This ought to give you
> > an error at assembly or link time.
> 
> No error at assembly or link time.

> > If not, you have a bad assembler or linker..
> 
> Well, we'll have to live with them!-(EOL target).

The system as is based on gas-1.38 and doesn't warn for this :-(
ld64 is slightly better and does catch a few more cases (where they resolve at
link-time).

.. there's some hope for my WIP GAS port and an updated ld64 (yeah, I know it's
taking a long time for these to appear) ..

> > movdi_low is the culprit, I think.  It should require a suitably aligned
> > offset (operand 2).
> 
> How?

In the mdynamic-no-pic case, the literal value should work the same as for
linux.

In the case of PIC, I suspect we need to look through the uspecs that wrap
mach-o PIC offsets and try to determine if the alignment of the referenced
symbol is guaranteed to be "enough".  The alignment of the picbase will always
be >= 4.

Some time ago I had a WIP patch to try and deal with this … but it's bit-rotted
so needs a significant re-visit.
>From gcc-bugs-return-479655-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Mar 07 17:16:19 2015
Return-Path: <gcc-bugs-return-479655-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 68161 invoked by alias); 7 Mar 2015 17:16:18 -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 68148 invoked by uid 48); 7 Mar 2015 17:16:14 -0000
From: "jezz at hkfree dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65344] New: Exception is not catched on AIX - class with more ancestors, virtual method throws
Date: Sat, 07 Mar 2015 17:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jezz at hkfree dot org
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-65344-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: 2015-03/txt/msg00799.txt.bz2
Content-length: 5401

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide344

            Bug ID: 65344
           Summary: Exception is not catched on AIX - class with more
                    ancestors, virtual method throws
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jezz at hkfree dot org

Created attachment 34983
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4983&actioníit
Sources for reproducing

In my program exception is not catched, when it is compiled with gcc newer than
4.4 (4.2.4 & 4.4.7 works). I have created sample (sample with Makefile in in
attachment). I have tested the sample with 4.5.4 and 4.8.3 - both fails. All
compilers are from http://www.perzl.org/aix/index.php?n=Main.Gcc

This is output from sample compiled with 4.4.7:

./main
Case 1:

Case 2:
(Class*)ThrowingClass=0x0x200013b8
(DoThrowIface*)this=0x0x200013bc
(DoThrowIface*)ThrowingClass=0x0x200013bc
Called doThrow.
Thrown && catched BaseException.
End.

This is output from sample compiled with 4.8.3:
 ./main
Case 1:

Case 2:
(Class*)ThrowingClass=0x0x20001ab8
(DoThrowIface*)this=0x0x20001abc
(DoThrowIface*)ThrowingClass=0x0x20001abc
Called doThrow.
terminate called after throwing an instance of 'Exception'

(gdb) where
#0  0xd37bd440 in raise () from /usr/lib/libc.a(shr.o)
#1  0xd384bca8 in abort () from /usr/lib/libc.a(shr.o)
#2  0xd8055610 in __gnu_cxx::__verbose_terminate_handler () at  _start_ :95
#3  0xd80609ec in __cxxabiv1::__terminate (handler=<incomplete type>)
    at  _start_ :38
#4  0xd8055404 in std::terminate () at  _start_ :48
#5  0xd8060d7c in __cxa_throw (obj=<incomplete type>,
    tinfo=<incomplete type>, dest=<incomplete type>) at  _start_ :87
#6  0x10001604 in ThrowingClass::doThrow (this=0x20001ab8)
    at throwing_class.cc:24
#7  0x100006a8 in main (argc=1, argv=0x2ff22af4) at main.cc:39

g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.8.3/lto-wrapper
Target: powerpc-ibm-aix6.1.0.0
Configured with: ../gcc-4.8.3/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --prefix=/opt/freeware
--mandir=/opt/freeware/man --infodir=/opt/freeware/info
--enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd
--host=powerpc-ibm-aix6.1.0.0
Thread model: aix
gcc version 4.8.3 (GCC)


Sample sources:

base.hh:
#ifndef BASE_HH
#define BASE_HH 1

class Exception
   {
   public:
      Exception() {}
   };

class Iface
   {
   public:
      virtual ~Iface() {}
   };

class Class
   {
   public:
      virtual ~Class() {}
      virtual Iface *getIface() = 0;
   };

class DoThrowIface
   : public Iface
   {
   public:
      virtual void doThrow() = 0;
   };

class Registrator
   {
   public:
      virtual Class* getClass() = 0;
   };

#endif /* BASE_HH */

throwing_class.hh:
#ifndef THROWING_CLASS_HH
#define THROWING_CLASS_HH 1

class ThrowingClass
   : public Class
   , public DoThrowIface
   {
   public:
      virtual void doThrow();
      virtual Iface *getIface();
   };

#endif /* THROWING_CLASS_HH */

throwing_class.cc:
#include <iostream>
#include "base.hh"
#include "throwing_class.hh"

extern Registrator *reg;

// This class must be in separate object file
class ThrowingClassRegistrator : public Registrator
   {
   public:
      ThrowingClassRegistrator()
         {
         reg = this;
         }
      virtual Class *getClass()
         {
         return new ThrowingClass();
         }
   } ThrowingClassRegistrator_I;

void ThrowingClass::doThrow()
   {
   std::cout << "Called doThrow." << std::endl;
   throw Exception();
   }

Iface *ThrowingClass::getIface()
   {
   std::cout << "(DoThrowIface*)this=0x" << (DoThrowIface*)this << std::endl;
   return static_cast<DoThrowIface*>(this);
   }


main.cc:
#include <iostream>
#include <exception>
#include "base.hh"
#include "throwing_class.hh"

Registrator *reg;

int
main(int argc, char *argv[])
   {
   std::cout << "Case 1:" << std::endl;
   try
      {
      // This always works, but if I uncomment this, case 2 is also working.
      /*
      Class *throwingClass = new ThrowingClass();
      std::cout << "(Class*)ThrowingClass=0x" << throwingClass << std::endl;
      DoThrowIface *throwIface = (DoThrowIface *)throwingClass->getIface();
      std::cout << "(DoThrowIface*)ThrowingClass=0x" << throwIface <<
std::endl;
      throwIface->doThrow();
      //*/
      }
   catch (Exception const& e)
      {
      std::cout << "Thrown && catched BaseException." << std::endl;
      }
   catch (...)
      {
      std::cout << "General catch." << std::endl;
      }

   std::cout << std::endl << "Case 2:" << std::endl;
   try
      {
      Class *throwingClass = reg->getClass();
      std::cout << "(Class*)ThrowingClass=0x" << throwingClass << std::endl;
      DoThrowIface *throwIface = (DoThrowIface *)throwingClass->getIface();
      std::cout << "(DoThrowIface*)ThrowingClass=0x" << throwIface <<
std::endl;
      throwIface->doThrow();
      }
   catch (Exception const& e)
      {
      std::cout << "Thrown && catched BaseException." << std::endl;
      }
   catch (...)
      {
      std::cout << "General catch." << std::endl;
      }
   std::cout << "End." << std::endl;
   return 0;
   }


  parent reply	other threads:[~2015-03-07 16:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07 10:01 [Bug target/65342] New: " dominiq at lps dot ens.fr
2015-03-07 13:27 ` [Bug target/65342] " amodra at gmail dot com
2015-03-07 13:40 ` dominiq at lps dot ens.fr
2015-03-07 16:55 ` iains at gcc dot gnu.org [this message]
2015-03-09 12:16 ` rguenth at gcc dot gnu.org
2015-03-09 14:31 ` jakub at gcc dot gnu.org
2015-03-10  8:22 ` amodra at gmail dot com
2015-03-10  8:44 ` iains at gcc dot gnu.org
2015-03-10 12:44 ` amodra at gmail dot com
2015-03-10 12:59 ` iains at gcc dot gnu.org
2015-03-10 13:13 ` iains at gcc dot gnu.org
2015-03-10 13:33 ` amodra at gmail dot com
2015-03-10 13:36 ` amodra at gmail dot com
2015-03-16  9:38 ` iains at gcc dot gnu.org
2015-03-16 12:02 ` amodra at gmail dot com
2015-03-16 12:09 ` iains at gcc dot gnu.org
2015-03-25 14:32 ` dominiq at lps dot ens.fr
2015-04-09 10:13 ` iains at gcc dot gnu.org
2015-04-09 10:41 ` dominiq at lps dot ens.fr
2015-04-22 12:00 ` [Bug target/65342] [5/6 " jakub at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org

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-65342-4-M2NqYNGpgl@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).