Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in ast-merge to new ast file #72783

Open
yangxili2023 opened this issue Nov 19, 2023 · 2 comments
Open

error in ast-merge to new ast file #72783

yangxili2023 opened this issue Nov 19, 2023 · 2 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@yangxili2023
Copy link

yangxili2023 commented Nov 19, 2023

When ast-merge two AST files, the one using <math.h> or <stdio.h>..., to one AST file, there is an error and request me submit the bug report.

llvm version 17.0.0 up

1.Edit a c source file:

#include <math.h>
void func()
{
return;
}

  1. Check the compile environment:

clang -E -x c - -v

  1. Compile the c file to ast file:

clang -cc1 -triple x86_64-pc-windows-msvc19.16.27027 -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -v "-fcoverage-compilation-dir=D:\llvm\example\err" -resource-dir "C:\Program Files\LLVM\lib\clang\17" -internal-isystem "C:\Program Files\LLVM\lib\clang\17\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\include" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt" "-fdebug-compilation-dir=D:\llvm\example\err" -ferror-limit 19 -fmessage-length=120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.16.27027 -fdelayed-template-parsing -fcolor-diagnostics -faddrsig a.c -emit-pch -o a.ast

4.Merge this ast file (with or not with other ast file) to new ast file:

clang -cc1 -ast-merge a.ast NUL -emit-pch -o aa.ast

  1. Shell output:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -cc1 -ast-merge a.ast NUL -emit-pch -o aa.ast

  1.  <eof> parser at end of file
    

Exception Code: 0xC0000005
#0 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x3dd629b C:\Program Files\LLVM\bin\clang.exe 0x3de1118
#1 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x3ddf904 C:\Program Files\LLVM\bin\clang.exe 0x362ff3c
#2 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x35d5db3 C:\Program Files\LLVM\bin\clang.exe 0x2340013
#3 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2b17f4e C:\Program Files\LLVM\bin\clang.exe 0x30497
#4 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2ff37 C:\Program Files\LLVM\bin\clang.exe 0x2c82d
#5 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2b306 C:\Program Files\LLVM\bin\clang.exe 0x29afe
#6 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x131511 C:\Program Files\LLVM\bin\clang.exe 0x12edb1
#7 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x23c68b0 (C:\Program Files\LLVM\bin\clang.exe+0x3dd629b)
#8 0x00007ff78f26629b
#9 0x00007ff78f26629b (C:\Program Files\LLVM\bin\clang.exe+0x3dd629b)
0x00007FF78F26629B, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DD629B byte(s)
0x00007FF78F271118, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DE1118 byte(s)
0x00007FF78F26F904, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DDF904 byte(s)
0x00007FF78EABFF3C, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x362FF3C byte(s)
0x00007FF78EA65DB3, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x35D5DB3 byte(s)
0x00007FF78D7D0013, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2340013 byte(s)
0x00007FF78DFA7F4E, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2B17F4E byte(s)
0x00007FF78B4C0497, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x30497 byte(s)
0x00007FF78B4BFF37, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2FF37 byte(s)
0x00007FF78B4BC82D, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2C82D byte(s)
0x00007FF78B4BB306, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2B306 byte(s)
0x00007FF78B4B9AFE, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x29AFE byte(s)
0x00007FF78B5C1511, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x131511 byte(s)
0x00007FF78B5BEDB1, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x12EDB1 byte(s)
0x00007FF78D8568B0, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x23C68B0 byte(s)
0x00007FF8622F7614, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FF8622E0000) + 0x17614 byte(s), BaseThreadInitThunk() + 0x14 byte(s)
0x00007FF8632C26A1, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FF863270000) + 0x526A1 byte(s), RtlUserThreadStart() + 0x21 byte(s)

  1. Try an other c file:

void func()
{
return;
}

everything is ok.

@yangxili2023
Copy link
Author

Thanks everybody! It's OK.

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Nov 28, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 28, 2023

@llvm/issue-subscribers-clang-frontend

Author: Old Head Music (yangxili2023)

When ast-merge two AST files, the one using `<math.h>` or `<stdio.h>`..., to one AST file, there is an error and request me submit the bug report.

llvm version 17.0.0 up

1.Edit a c source file:

#include <math.h>
void func()
{
return;
}

  1. Check the compile environment:

clang -E -x c - -v

  1. Compile the c file to ast file:

clang -cc1 -triple x86_64-pc-windows-msvc19.16.27027 -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -v "-fcoverage-compilation-dir=D:\llvm\example\err" -resource-dir "C:\Program Files\LLVM\lib\clang\17" -internal-isystem "C:\Program Files\LLVM\lib\clang\17\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\atlmfc\include" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt" "-fdebug-compilation-dir=D:\llvm\example\err" -ferror-limit 19 -fmessage-length=120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.16.27027 -fdelayed-template-parsing -fcolor-diagnostics -faddrsig a.c -emit-pch -o a.ast

4.Merge this ast file (with or not with other ast file) to new ast file:

clang -cc1 -ast-merge a.ast NUL -emit-pch -o aa.ast

  1. Shell output:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -cc1 -ast-merge a.ast NUL -emit-pch -o aa.ast

  1.  &lt;eof&gt; parser at end of file
    

Exception Code: 0xC0000005
#0 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x3dd629b C:\Program Files\LLVM\bin\clang.exe 0x3de1118
#1 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x3ddf904 C:\Program Files\LLVM\bin\clang.exe 0x362ff3c
#2 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x35d5db3 C:\Program Files\LLVM\bin\clang.exe 0x2340013
#3 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2b17f4e C:\Program Files\LLVM\bin\clang.exe 0x30497
#4 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2ff37 C:\Program Files\LLVM\bin\clang.exe 0x2c82d
#5 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x2b306 C:\Program Files\LLVM\bin\clang.exe 0x29afe
#6 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x131511 C:\Program Files\LLVM\bin\clang.exe 0x12edb1
#7 0x00007ff78f26629b C:\Program Files\LLVM\bin\clang.exe 0x23c68b0 (C:\Program Files\LLVM\bin\clang.exe+0x3dd629b)
#8 0x00007ff78f26629b
#9 0x00007ff78f26629b (C:\Program Files\LLVM\bin\clang.exe+0x3dd629b)
0x00007FF78F26629B, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DD629B byte(s)
0x00007FF78F271118, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DE1118 byte(s)
0x00007FF78F26F904, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x3DDF904 byte(s)
0x00007FF78EABFF3C, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x362FF3C byte(s)
0x00007FF78EA65DB3, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x35D5DB3 byte(s)
0x00007FF78D7D0013, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2340013 byte(s)
0x00007FF78DFA7F4E, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2B17F4E byte(s)
0x00007FF78B4C0497, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x30497 byte(s)
0x00007FF78B4BFF37, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2FF37 byte(s)
0x00007FF78B4BC82D, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2C82D byte(s)
0x00007FF78B4BB306, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x2B306 byte(s)
0x00007FF78B4B9AFE, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x29AFE byte(s)
0x00007FF78B5C1511, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x131511 byte(s)
0x00007FF78B5BEDB1, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x12EDB1 byte(s)
0x00007FF78D8568B0, C:\Program Files\LLVM\bin\clang.exe(0x00007FF78B490000) + 0x23C68B0 byte(s)
0x00007FF8622F7614, C:\WINDOWS\System32\KERNEL32.DLL(0x00007FF8622E0000) + 0x17614 byte(s), BaseThreadInitThunk() + 0x14 byte(s)
0x00007FF8632C26A1, C:\WINDOWS\SYSTEM32\ntdll.dll(0x00007FF863270000) + 0x526A1 byte(s), RtlUserThreadStart() + 0x21 byte(s)

  1. Try an other c file:

void func()
{
return;
}

everything is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants