Skip to content

Strange (?) ReadGuard placement #39

Description

@fingolfin

I am seeing some compiler warnings for some code mangled by ward. Specifically, ward turns this code:

  else {
    ErrorQuit( "usage: DownEnv( [ <depth> ] )", 0L, 0L );
    return 0;
  }

into this:

  else {
    {
    ReadGuard(args);
#line 978 "../../src/gap.c"
    ErrorQuit( "usage: DownEnv( [ <depth> ] )", 0L, 0L );
    }
#line 979 "../../src/gap.c"
    return ReadGuard(args), 0;
  }
}

The warning I get is this:

../../src/gap.c:979:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'Obj' (aka 'unsigned long long **') [-Wint-conversion]
    return ReadGuard(args), 0;
           ^~~~~~~~~~~~~~~~~~

As it is, I am confused: Why does ward insert ReadGuard(args) here at all, and why twice?

Is this a bug (resp. a case of ward being too eager), or am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions