public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65503] New: g++ string array in struct crash
@ 2015-03-21 12:48 gpkiwi at msn dot com
  2015-03-22 15:20 ` [Bug c++/65503] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gpkiwi at msn dot com @ 2015-03-21 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65503
           Summary: g++ string array in struct crash
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gpkiwi at msn dot com

Created attachment 35082
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35082&action=edit
file produced by >gcc -v -save-temps -Wall -Wextra c.cc

This crashes mingw g++ (GCC) 4.8.1 XP home SP3
Ubuntu 4.8.1-2ubuntu1~12.04 with s[99999] it hangs.

>gcc c.cc  -Wall -Wextra
>gcc c.cc  -Wall -Wextra -fno-strict-aliasing -fwrapv

#include <string>
struct T {
   std::string s[4065]; // 4064 is OK
};
int main() {
   T m = {"x", "y"};
} 


>gcc -v -save-temps -Wall -Wextra c.cc
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32
--build=mingw32 --without-pic --enable-shared --e
nable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib
--enable-languages=c,c++,fortran,objc,obj-c++
,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry
--enable-libstdcxx-debug --enable-version-specific
-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld
--with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --
with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes
--enable-libgomp --enable-threads --with-libiconv
-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s
CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-mtune=generic'
'-march=pentiumpro'
 c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1plus.exe -E -quiet -v -iprefix
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/ c.cc
 -mtune=generic -march=pentiumpro -Wall -Wextra -fpch-preprocess -o c.ii
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++/mingw32"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include/c++/backward"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../include"
ignoring duplicate directory "/mingw/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include-fixed"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include/c++
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include/c++/mingw32
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include/c++/backward
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../include
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include-fixed
 c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-mtune=generic'
'-march=pentiumpro'
 c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1plus.exe -fpreprocessed c.ii
-quiet -dumpbase c.cc -mtune=generic -march=p
entiumpro -auxbase c -Wall -Wextra -version -o c.s
GNU C++ (GCC) version 4.8.1 (mingw32)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130944
GNU C++ (GCC) version 4.8.1 (mingw32)
        compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=130944
Compiler executable checksum: 1ebc2a6f92fbd3aadc367a20a63fdf9f


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/65503] g++ string array in struct crash
  2015-03-21 12:48 [Bug c++/65503] New: g++ string array in struct crash gpkiwi at msn dot com
@ 2015-03-22 15:20 ` redi at gcc dot gnu.org
  2015-03-26 18:38 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-22 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You're creating a huge object on the stack, which is a bad idea, and the
problem is probably that GCC is running out of memory.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/65503] g++ string array in struct crash
  2015-03-21 12:48 [Bug c++/65503] New: g++ string array in struct crash gpkiwi at msn dot com
  2015-03-22 15:20 ` [Bug c++/65503] " redi at gcc dot gnu.org
@ 2015-03-26 18:38 ` jason at gcc dot gnu.org
  2021-11-29  1:35 ` pinskia at gcc dot gnu.org
  2022-01-07  0:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-26 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Mikhail Maltsev from comment #2)
> Also, I noticed that in some cases GCC is able to generate a loop for
> initialization:
> 
> #include <string>
> 
> int main() {
>     std::string m[1000] {"x", "y"};
>     std::string n[1000] = {"x", "y"};
> }
> 
> That is done in cp/init.c:build_vec_init. But for the original testcase, the
> loop is not created. Is it a bug?

It's a poor optimization choice; we ought to build a loop for member array
initialization as well as array variables.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/65503] g++ string array in struct crash
  2015-03-21 12:48 [Bug c++/65503] New: g++ string array in struct crash gpkiwi at msn dot com
  2015-03-22 15:20 ` [Bug c++/65503] " redi at gcc dot gnu.org
  2015-03-26 18:38 ` jason at gcc dot gnu.org
@ 2021-11-29  1:35 ` pinskia at gcc dot gnu.org
  2022-01-07  0:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-29  1:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92385

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect PR 92385 is a similar issue as here.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/65503] g++ string array in struct crash
  2015-03-21 12:48 [Bug c++/65503] New: g++ string array in struct crash gpkiwi at msn dot com
                   ` (2 preceding siblings ...)
  2021-11-29  1:35 ` pinskia at gcc dot gnu.org
@ 2022-01-07  0:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07  0:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes this is fixed after the patch for PR 92385 so closing as a dup.

*** This bug has been marked as a duplicate of bug 92385 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-07  0:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-21 12:48 [Bug c++/65503] New: g++ string array in struct crash gpkiwi at msn dot com
2015-03-22 15:20 ` [Bug c++/65503] " redi at gcc dot gnu.org
2015-03-26 18:38 ` jason at gcc dot gnu.org
2021-11-29  1:35 ` pinskia at gcc dot gnu.org
2022-01-07  0:48 ` pinskia at gcc dot gnu.org

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).