Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • F frama-c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 209
    • Issues 209
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • pub
  • frama-c
  • Issues
  • #2574

Closed
Open
Created Sep 15, 2021 by Karine EM@karineek

Frama-c fails parsing gcc/llvm single source test case with typedef depended on function's parameter

Steps to reproduce the issue

frama-c 20040411-1.c

Expected behaviour

Frama-c cannot parse the following C single source test case from GCC/LLVM test suite. https://github.com/llvm/llvm-test-suite/blob/main/SingleSource/Regression/C/gcc-c-torture/execute/20040411-1.c and gcc and llvm seem to be able to compile the program:

gcc A_20040411-1.c
A_20040411-1.c: In function ‘sub1’:
A_20040411-1.c:10:7: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
   10 |       memcpy (x, y, 10 * sizeof (int));
      |       ^~~~~~
A_20040411-1.c:10:7: warning: incompatible implicit declaration of built-in function ‘memcpy’
A_20040411-1.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
  +++ |+#include <string.h>
    1 | /* corpus/20040411-1.c */
A_20040411-1.c: In function ‘main’:
A_20040411-1.c:20:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration]
   20 |     { abort (); }
      |       ^~~~~
A_20040411-1.c:20:7: warning: incompatible implicit declaration of built-in function ‘abort’
A_20040411-1.c:1:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abort’
  +++ |+#include <stdlib.h>
    1 | /* corpus/20040411-1.c */
./a.out

clang-12 A_20040411-1.c
A_20040411-1.c:10:7: warning: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Wimplicit-function-declaration]
      memcpy (x, y, 10 * sizeof (int));
      ^
A_20040411-1.c:10:7: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
A_20040411-1.c:20:7: warning: implicitly declaring library function 'abort' with type 'void (void) __attribute__((noreturn))' [-Wimplicit-function-declaration]
    { abort (); }
      ^
A_20040411-1.c:20:7: note: include the header <stdlib.h> or explicitly provide a declaration for 'abort'
2 warnings generated.
./a.out

Actual behaviour

Frama-c exit with the following error:

[kernel] Parsing /home/user42/directed-compiler-fuzzing-code/scripts/7-diff-testing/results_output/A_20040411-1.c (with preprocessing)
[kernel] /home/user42/directed-compiler-fuzzing-code/scripts/7-diff-testing/results_output/A_20040411-1.c:5: User Error: 
  Array length i + 2 is not a compile-time constant.
[kernel:typing:implicit-function-declaration] /home/user42/directed-compiler-fuzzing-code/scripts/7-diff-testing/results_output/A_20040411-1.c:10: Warning: 
  Calling undeclared function memcpy. Old style K&R code?
[kernel:typing:implicit-function-declaration] /home/user42/directed-compiler-fuzzing-code/scripts/7-diff-testing/results_output/A_20040411-1.c:20: Warning: 
  Calling undeclared function abort. Old style K&R code?
[kernel] User Error: stopping on
  file "/home/user42/directed-compiler-fuzzing-code/scripts/7-diff-testing/results_output/A_20040411-1.c"
  that has errors. Add '-kernel-msg-key pp' for preprocessing command.
[kernel] Frama-C aborted: invalid user input.

Contextual information

  • Frama-C installation mode: Opam 4.10.0
  • Frama-C version: 22.0 (Titanium)
  • Plug-in used: Plug-in used
  • OS name: Ubuntu
  • OS version: 18

Additional information (optional)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking