Skip to content

failing to build runtime on clang 10 #33681

@omajid

Description

@omajid

Clang 10 introduces a new warning -Walloca. This breaks compiling runtime:

/runtime/src/libraries/Native/Unix/System.Native/pal_io.c(924,64): error G8742B11B: use of function '__builtin_alloca' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability [-Werror,-Walloca] [/runtime/src/libraries/Native/build-native.proj]
      struct pollfd* pollfds = (struct pollfd*)(useStackBuffer ? alloca(bufferSize) : malloc(bufferSize));
                                                                 ^
  /usr/include/alloca.h:35:23: note: expanded from macro 'alloca'
  # define alloca(size)   __builtin_alloca (size)
                          ^
  1 error generated.

Should we disable this warning? Should we fix some uses? I know that coreclr has some extra checks (via AllocaCheck) and I dont think clang 10 flags those.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions