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

            Bug ID: 87865
           Summary: gdc doesn't build unless assert is marked noreturn
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
              Host: *-*-solaris2.10

When I tried to build gdc on Solaris 10, it failed to compile like this:

/vol/gcc/src/hg/trunk/local/gcc/d/dmd/arrayop.c: In member function 'virtual
void buildArrayIdent(Expression*, OutBuffer*,
Expressions*)::BuildArrayIdentVisitor::visit(BinAssignExp*)':
/vol/gcc/src/hg/trunk/local/gcc/d/dmd/arrayop.c:336:29: error: 's' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  336 |             buf->writestring(s);
      |             ~~~~~~~~~~~~~~~~^~~

/vol/gcc/src/hg/trunk/local/gcc/d/dmd/ctfeexpr.c: In function 'int
comparePointers(TOK, Expression*, dinteger_t, Expression*, dinteger_t)':
/vol/gcc/src/hg/trunk/local/gcc/d/dmd/ctfeexpr.c:925:13: error: 'n' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  925 |         int n;
      |             ^

and several more, obviously due to assert not being marked noreturn in
<assert.h>, unlike Solaris 11.

When I manually add __attribute__((__noreturn__)) to the _assert declarations
and place the result in gcc/include-fixed/assert.h, the gdc compilation to
finish.

If only a single target were affected by this, doing the fixup via fixincludes
might be an options; in case there are others, that doesn't seem the right
solution.

In fact, gdc should use gcc_unreachable () anyway: gcc/tsystem.h adds the
noreturn attribute to the declaration to avoid the failure.

Reply via email to