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 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • 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
  • !96

Check that serialisation/deserialisation types match [fixes #2242].

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Artem Shinkarov requested to merge tema/sac2c:fix-size-t-error into develop Dec 03, 2018
  • Overview 0
  • Commits 1
  • Changes 2

The core of the problem is that numeric constant 0 or 1 are of type int. When we serialise AST, we use something like fprinf (out, "foo (1, %zu)", some_sizet_var), which prints to 0, which is int by default. The function definition of foo is something like:

size_t
foo (size_t count, ...) {
   va_start (ap, count);
   size_t x = va_arg (ap, size_t);
   va_end ();
   return x;
}

For more information see #2242 (closed). In this MR at serialisation time we generate not just a numerical value, but also a static assertion that this value is of the right type. The static assertion will terminate compilation of tree files in case the sizes don't match.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix-size-t-error