Menu

#123 GDB 5.3 compiler error using newer GCC

open
nobody
None
5
2014-08-17
2014-08-10
No

When compileing gdb5.3 with prc-tools 2.3 patches, the following error is reported:

../../../prc-tools-2.3/gdb/gdb/../include/obstack.h:426:30: error: lvalue required as increment operand
((void )__o->next_free)++ = ((void )datum);

The problem is that when you perform a cast on the expression that is being incremented. The C99 standard says this in a footnote:

A cast does not yield an lvalue

And the post-increment operator requires an lvalue.

Discussion

  • Erlend Nagel

    Erlend Nagel - 2014-08-10

    replace the line above with:
    *((void **)__o->next_free) = ((void *)datum); \
    (void **)__o->next_free++; \

    basically separating the cast and the increment into two statements.

     

    Last edit: Erlend Nagel 2014-08-10
  • Erlend Nagel

    Erlend Nagel - 2014-08-10

    Attached is a patch file for gdb-5.3/include/obstack.h. Thanks to:

    http://wiki.wxwidgets.org/Development:_wxPalm

    could it be included for prc-tools-2.3.1?

    apologies for the bad formatting in the bug report.

     

Log in to post a comment.