[Bug c++/86738] New: gcc 8.2: Internal compiler error memcpy

joerg.danne at nokia dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 30 14:04:00 GMT 2018


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

            Bug ID: 86738
           Summary: gcc 8.2: Internal compiler error memcpy
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joerg.danne at nokia dot com
  Target Milestone: ---

Created attachment 44465
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44465&action=edit
g++ hugo.cc ---> causes internal compiler error

/home/jdanne/gnu2/bin/g++ hugo.cc
hugo.cc: In member function 'int FooBarEvent::showFooBar()':
hugo.cc:38:108: internal compiler error: Segmentation fault
   memcpy(formatId, &(remoteInvDataString[((unsigned int) (unsigned
long)&((FooBarData *)0)->FormateID)]), 2);
                                                                               
                            ^
0xbb58ef crash_signal
        ../../gcc/toplev.c:325
0xe4c1b3 selt
        ../../gcc/wide-int.cc:404
0xe4c1b3 wi::lts_p_large(long const*, unsigned int, unsigned int, long const*,
unsigned int)
        ../../gcc/wide-int.cc:480
0x67032b bool wi::les_p<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
        ../../gcc/wide-int.h:1917
0x67032b wi::binary_traits<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >,
wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type,
wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::precision_type>::signed_predicate_result
operator<=<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
        ../../gcc/wide-int.h:3171
0x67032b tree_int_cst_le(tree_node const*, tree_node const*)
        ../../gcc/tree.h:5737
0x67032b cxx_eval_array_reference
        ../../gcc/cp/constexpr.c:2429
0x67032b cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:4504
0x66e334 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:4366
0x66df00 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:4598
0x671e79 cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.c:4861
0x673dae maybe_constant_value(tree_node*, tree_node*)
        ../../gcc/cp/constexpr.c:5079
0x67d9fa cp_fully_fold(tree_node*)
        ../../gcc/cp/cp-gimplify.c:2110
0x6835a7 cp_convert_and_check(tree_node*, tree_node*, int)
        ../../gcc/cp/cvt.c:651
0x64e134 convert_like_real
        ../../gcc/cp/call.c:7126
0x6518d9 build_over_call
        ../../gcc/cp/call.c:7999
0x653ab7 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/cp/call.c:4319
0x75f4ad finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/cp/semantics.c:2537
0x711e91 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:7238
0x7125d1 cp_parser_unary_expression
        ../../gcc/cp/parser.c:8317
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


===================

/home/jdanne/gnu2/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/jdanne/gnu2/bin/g++
COLLECT_LTO_WRAPPER=/home/jdanne/gnu2/libexec/gcc/x86_64-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure --enable-languages=c,c++ --enable-multiarch
--enable-shared --enable-threads=posix --with-arch-32=i686 --disable-bootstrap
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-checking=release
--prefix=/home/jdanne/gnu2 --with-cpu=generic --enable-multilib --enable-nls
Thread model: posix
gcc version 8.2.0 (GCC) 


===================================

Code which caused the internal compiler error:
----------------------------------------------


typedef unsigned int size_t;

extern void *memcpy (void *__restrict __dest,
       __const void *__restrict __src, size_t __n)
     throw () __attribute__ ((__nonnull__ (1, 2)));


typedef struct {
    char FormateID[2];
    char x1[4];
    char x2[8];
    char x3[10];
    char x4[14];
    char x5[14];
    char x6[4];
    char x7[16];
    char x8[2];
    char x9[6];
    char x10[46];
}FooBarData;


class FooBarEvent
{
  public:
     int showFooBar();

};


int FooBarEvent::showFooBar()
{
  char dbgBuf[256];

  unsigned char remoteInvDataString[10];

  unsigned char formatId[2+1];
  memcpy(formatId, &(remoteInvDataString[((unsigned int) (unsigned
long)&((FooBarData *)0)->FormateID)]), 2);

  return 0;
}


More information about the Gcc-bugs mailing list