delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/23/07:38:46

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=kh1HsXtoWIKniv4z/NsswbwLTC/Ih
6rcD6ZiRmvPZY3kh9xyQ6A6kzPvB19XGLBWEZEvihRWpgHI3cVRVq75z564e+bW3
cIdPJt1muzG92aoAeNtU1fE81UtAW0zExawsyQ5kOZzMRJDy9lJwRdVfUS8F10df
1jx7Dj0r75QQw4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=JJW+kT/KWFwi0jFOIzN7ebAtnVc=; b=DJe
f8Frn008Uf3B4u43OPvKwONEhfAbe21s58ALbKADnAfFHe2XA8YYV4eny4jz6cd9
Jeok51kJPM3g+CMrB/4H6Upn2E/LgZiXtWFispL5eUD2pQ4qB1QWxWLBhu3uFWCF
QZpvwvzllxu4aNmMDXewFjSb+VE7UcB+kKa29RxQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=
X-HELO: mail-ua0-f171.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Ofe2Yl2iJG1iGLwx4Jvv7Wzt4dHNTTvqsi3ro/HhsxE=; b=ewlurv+MozX/o6C0EVUw68IrfUFxsCRW+N4I7zrP2aHDCrj/q3lIVdC+XIoYwctbEg 3iucnQdQPRf59D9fIi55Vi/0nV4RpQVt1bn/B684TVt+ME+mOmlJK22xOIqcjy3rm4ge 5ruEYv/aXIRUMpEXz3Y3H8G96SxWDWfa+U4HxDD5WWmxgRuYW3son5MjbZv7K7yHmyK5 sMScCB3KCulda1t30Q1mXmKB4nfPbQjyX91o6W5ISCT0FQBLaSd/AhlAKXpw8Ez2OZ/8 Y/rR1NygVmYvmpAADiqV6zFqotympC4SuZHBRvcH+2whZpNk+VPQr1TFHy6Cq03J7L99 llqA==
X-Gm-Message-State: AIVw110gmxl1w1OSCyqgiP/N6NjAqsfyOUfwt9OJaO0t4LU06fgPYs9h Fo1yzwOU2Hmxn/F7Np5+3/Cp8GmP9tvO
X-Received: by 10.176.71.19 with SMTP id h19mr6454458uac.138.1500809897663; Sun, 23 Jul 2017 04:38:17 -0700 (PDT)
MIME-Version: 1.0
From: Irfan Adilovic <irfanadilovic AT gmail DOT com>
Date: Sun, 23 Jul 2017 13:38:17 +0200
Message-ID: <CAJoYywWYpcOPDCsjTBz0jDnsTvqzB=Bx3m-E7Bpxc72BM8=RGw@mail.gmail.com>
Subject: gcc-7.1.0/c++17/old-abi: empty stringstream invalid memory access
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

I am reproducing here a bug report I filed to gcc's bugzilla against
gcc-7.1.0: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81522 , in
hopes of finding others who observed the same issue or who may have a
solution. The bug only appears on Cygwin and only in c++17 mode with
the old ABI.

-- Irfan

This trivial program:

#include <sstream>
int main() {
std::stringstream os; // same with ("") or (std::string())
os.str();
return 0;
}

causes an invalid memory access with gcc 7.1.0 (compiled from source),
but only on Cygwin in c++17 mode with old ABI, and only if the
stringstream is constructed empty. Changing any of those parameters no
longer causes the issue.

Thread 1 "string" received signal SIGABRT, Aborted.
0x00000001004018a0 in __gnu_cxx::new_allocator<char>::deallocate
(this=0x6, __p=0x3e8000003fc <error: Cannot access memory at address
0x3e8000003fc>)
at /usr/local/gcc-7.1.0/include/c++/7.1.0/ext/new_allocator.h:125
125 ::operator delete(__p);
(gdb) bt
#0 0x00000001004018a0 in __gnu_cxx::new_allocator<char>::deallocate
(this=0x6, __p=0x3e8000003fc <error: Cannot access memory at address
0x3e8000003fc>)
at /usr/local/gcc-7.1.0/include/c++/7.1.0/ext/new_allocator.h:125
#1 0x00000001800b25d2 in CreateEventW () from /usr/bin/cygwin1.dll
#2 0x0000000000000130 in ?? ()

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-7.1.0/libexec/gcc/x86_64-pc-cygwin/7.1.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: ../configure --prefix=/usr/local/gcc-7.1.0
--enable-threads=posix --enable-checking=release
--enable-languages=c,c++ --build=x86_64-pc-cygwin --disable-multilib
--with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 7.1.0 (GCC)

Sample program compiled with:

$ g++ -std=c++17 -D_GLIBCXX_USE_CXX11_ABI=0 -ggdb -O0 string.cc -o string

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019