Skip to content

Unprototyped function pointers may cause assert error #477

Open
@kyleheadley

Description

@kyleheadley

the following code will trigger an assert error:

int * primary_merge(int * (*secondary_merge)());
int * primary_merge(int * (*secondary_merge)(int*));

see the regression tests merge_fp{1,2}.c

The problem is that the primary merge has no preferred order, but the secondary does. 3C chooses primary order in ProgramInfo:512, but not the secondary one (see ConstraintVariables:1772).

If this happens in one translation unit (one file), there is an easy fix because clang tracks redecls. But this doesn't work across multiple files, so we need to check the parameter count when merging function pointers, choose the order, and store the merged value back into FV.

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