public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67104] Constant expression factory function initializes std::array with static storage duration strangely
Date: Mon, 03 Aug 2015 18:29:00 -0000	[thread overview]
Message-ID: <bug-67104-4-EJdECa8uNr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67104-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: 3958 bytes --]

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-03
                 CC|                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
markus@x4 tmp % cat te3.ii
namespace std
{
typedef int size_t;
template <typename _Tp, int _Nm> struct A
{
  typedef int _Type[_Nm];
  static constexpr _Tp
  _S_ref (const _Type __t, size_t)
  {
    return __t[0];
  }
};
template <typename, int _Nm> struct array
{
  typedef int const_reference;
  typedef int size_type;
  typedef A<int, _Nm> _AT_Type;
  typename _AT_Type::_Type _M_elems;
  constexpr const_reference operator[](size_type) const
  {
    return _AT_Type::_S_ref (_M_elems, 0);
  }
};
}

constexpr auto make_array (int val)
{
  std::array<int, 2> result{ val, 0 };
  return result;
}

constexpr auto numbers_static = make_array (1);
int
main ()
{
  static_assert (numbers_static[0], "");
}

markus@x4 tmp % clang++ -std=c++14 te3.ii
markus@x4 tmp % g++ -std=c++14 te3.ii
te3.ii: In function ‘int main()’:
te3.ii:36:3: error: static assertion failed: 
   static_assert (numbers_static[0], "");
   ^
>From gcc-bugs-return-493987-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 03 18:35:23 2015
Return-Path: <gcc-bugs-return-493987-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 124514 invoked by alias); 3 Aug 2015 18:35:23 -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 123993 invoked by uid 48); 3 Aug 2015 18:35:18 -0000
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66079] [6 Regression] memory leak with source allocation in internal subprogram
Date: Mon, 03 Aug 2015 18:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pault at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: pault at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-66079-4-cdhrR2CnWr@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66079-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66079-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-08/txt/msg00129.txt.bz2
Content-length: 592

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

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 36113
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id6113&actioníit
Patch for th 5 branch

Before closing this PR, I checked and found that the 5 branch now leaks memory.

The attached fixes the memory leak but does not fix the ICEs for which the
tests have been commented out. There is already too much divergence in
trans_allocate between 5 and 6 to do any more.

What do you think about applying this patch, which bootstraps and regtests?

Paul


  parent reply	other threads:[~2015-08-03 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 17:48 [Bug c++/67104] New: " moritz at klammler dot eu
2015-08-03 17:49 ` [Bug c++/67104] " moritz at klammler dot eu
2015-08-03 17:50 ` moritz at klammler dot eu
2015-08-03 17:59 ` moritz at klammler dot eu
2015-08-03 18:29 ` trippels at gcc dot gnu.org [this message]
2015-08-04  8:40 ` [Bug c++/67104] [5/6 regression] " trippels at gcc dot gnu.org
2015-08-07 13:54 ` trippels at gcc dot gnu.org
2015-08-12 18:03 ` jason at gcc dot gnu.org
2015-08-12 18:09 ` jason at gcc dot gnu.org
2015-08-13  7:20 ` trippels at gcc dot gnu.org
2015-08-13  7:32 ` [Bug c++/67104] [5 " trippels at gcc dot gnu.org
2015-08-17 15:45 ` jason at gcc dot gnu.org
2015-08-17 16:06 ` jason at gcc dot gnu.org
2015-08-17 18:42 ` jason 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-67104-4-EJdECa8uNr@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).