llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.04k stars 11.98k forks source link

Strange parsing bug #103502

Closed kylefurlong closed 2 months ago

kylefurlong commented 3 months ago

Note below that the error indicators actually point to the beginning brace of the flow function call, and the parser tells us that the flow_t object isn't a function or function pointer. Not where where this is getting mucked, but it sure isn't correct behavior.

(env) kylefurlong@Kyles-Mac-mini flow % clang -std=c17 -pedantic -O2 -g -I$(brew --prefix zeromq)/include -I$(brew --prefix zeromq)/lib -o stream streamer.c streamer.c:24:9: error: called object type 'flow_t' (aka 'struct not_flow_t') is not a function or function pointer flow(NULL, NULL, &flow);


streamer.c:43:13: error: called object type 'flow_t' (aka 'struct not_flow_t') is not a function or function pointer
        flow(frame, rep, &flow);
        ~~~~^
2 errors generated.
(env) kylefurlong@Kyles-Mac-mini flow % clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
llvmbot commented 3 months ago

@llvm/issue-subscribers-clang-frontend

Author: Kyle Furlong (kylefurlong)

Note below that the error indicators actually point to the beginning brace of the flow function call, and the parser tells us that the flow_t object isn't a function or function pointer. Not where where this is getting mucked, but it sure isn't correct behavior. (env) kylefurlong@Kyles-Mac-mini flow % clang -std=c17 -pedantic -O2 -g -I$(brew --prefix zeromq)/include -I$(brew --prefix zeromq)/lib -o stream streamer.c streamer.c:24:9: error: called object type 'flow_t' (aka 'struct not_flow_t') is not a function or function pointer flow(NULL, NULL, &flow); ~~~~^ streamer.c:43:13: error: called object type 'flow_t' (aka 'struct not_flow_t') is not a function or function pointer flow(frame, rep, &flow); ~~~~^ 2 errors generated. (env) kylefurlong@Kyles-Mac-mini flow % clang --version Apple clang version 14.0.3 (clang-1403.0.22.14.1) Target: arm64-apple-darwin22.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
EugeneZelenko commented 3 months ago

Could you please try to reproduce problem in LLVM (not Apple) 19 main branch? https://godbolt.org should be helpful.

Please provide reproducer.

kylefurlong commented 2 months ago

Mystery solved in the light of day. I name variables incorrectly.