Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 393
    • Issues 393
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !119

fix issue with GCC 10 (duplicate global variable declarations)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Hans-Nikolai Viessmann requested to merge hans/sac2c:hans-fix-gcc-common into develop Sep 04, 2020
  • Overview 1
  • Commits 2
  • Changes 6

With GCC 10, we get errors with multiple 'first' declarations of global variables. This is not something new, rather GCC in previous versions assumed these multiple declarations to be 'common'. In version 10+ this is not the case, with GCC running with -fno-common on by default.

See https://gcc.gnu.org/gcc-10/porting_to.html.

These declarations are coming from runtime/mt_h/schedule.h, where we define the SAC_MT_DEFINE() macro. This macro is expanded in the generated header file (header.h) and included in all function compilations units (e.g. fun1.c) and in globals.c. When we link the object files together, we get this conflict.

As it happens, there is no need for the SAC_MT_DEFINE() macro. In previous work to overhaul the MT backend, all of the global variable definitions were removed. The variables now exist within structs for the beehive.

With this, the fix is to remove the SAC_MT_DEFINE() definition and expansion call.

Edited Sep 06, 2020 by Hans-Nikolai Viessmann
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: hans-fix-gcc-common