Skip to content

Both prebuild release and manual installation crashed on Windows10 2004 caused by V panic: substr(4, 0) out of bounds (len=0) #19466

@cjun714

Description

@cjun714

Describe the bug

  1. Prebuild release crashed on Windows10 2004 when in REPL to eval or build any HelloWorld code

  2. Manual installation crashed using .\make.bat

Reproduction Steps

Prebuild release:

  1. download latest release: v-weekly.2023.39.zip

  2. extract it and add to PATH, before this I cleaned all PATH on Windows

  3. run cmd.exe

  4. run v

  5. repl is opened

  6. Input "2+3" and enter

  7. crash

  8. create an empty fn main(){} source file

  9. use v . to build

  10. crash

Manual installation:

  1. I removed all PATH on Windows
  2. I downloaded newest GCC 13.2.0 (MCF)from https://winlibs.com/ (winlibs-x86_64-mcf-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64ucrt-11.0.1-r2.7z) and extract to w:/
  3. I added path of git and mingw into PATH:
    image
  4. git clone https://github.com/vlang/v
  5. cd v and run .\make.bat
  6. build failed

Expected Behavior

Prebuild release can work without crash.

Manual installation can work.

Current Behavior

Prebuild binary crashed

W:\test>v --version
V 0.4.1 12ee3fa

W:\test>v
 ____    ____
 \   \  /   /  |  Welcome to the V REPL (for help with V itself, type  exit , then run  v help ).
  \   \/   /   |  Note: the REPL is highly experimental. For best V experience, use a text editor,
   \      /    |  save your code in a  main.v  file and execute:  v run main.v
    \    /     |  V 0.4.1 12ee3fa . Use  list  to see the accumulated program so far.
     \__/      |  Use Ctrl-C or  exit  to exit, or  help  to see other available commands.

>>> 2+3
V panic: substr(4, 0) out of bounds (len=0)
v hash: 12ee3fa
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
1 : BaseThreadInitThunk        ?? : address = 0x230ab381b40
0 : RtlUserThreadStart         ?? : address = 0x230ab3819d0
>>> exit


W:\test>dir
 驱动器 W 中的卷是 RAMDISK
 卷的序列号是 BE85-CFF2

 W:\test 的目录

2023/09/29  03:27    <DIR>          .
2023/09/29  03:27    <DIR>          ..
2023/09/29  03:27                13 main.v
               1 个文件             13 字节
               2 个目录 39,380,967,424 可用字节

W:\test>v .
V panic: substr(4, 0) out of bounds (len=0)
v hash: 12ee3fa
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
SymFromAddr failure: 487 = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)
1 : BaseThreadInitThunk        ?? : address = 0x29c397f4890
0 : RtlUserThreadStart         ?? : address = 0x29c397f4930

W:\test>

Compile from source crashed

Microsoft Windows [版本 10.0.19041.1415]
(c) Microsoft Corporation。保留所有权利。

C:\Users\John>w:

W:\>git clone https://github.com/vlang/v
Cloning into 'v'...
remote: Enumerating objects: 152524, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 152524 (delta 9), reused 23 (delta 7), pack-reused 152482
Receiving objects: 100% (152524/152524), 66.17 MiB | 6.60 MiB/s, done.
Resolving deltas: 100% (108757/108757), done.
Updating files: 100% (6975/6975), done.

W:\>cd v

W:\v>.\make.bat
系统找不到指定的路径。
Bootstrapping TCC...
 > TCC not found
 > Downloading TCC64 from https://github.com/vlang/tccbin , branch "thirdparty-windows-amd64"
remote: Enumerating objects: 165, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 165 (delta 1), reused 6 (delta 0), pack-reused 145
656.00 KiB/s
Receiving objects: 100% (165/165), 988.91 KiB | 797.00 KiB/s, done.
Resolving deltas: 100% (23/23), done.
commit e90c262006324ba64affd1b47839bace5f3288f8 (HEAD -> thirdparty-windows-amd64, origin/thirdparty-windows-amd64)
Author: d3c0d3d <0xc0d32@gmail.com>
Date:   Tue Mar 7 09:13:13 2023 -0300

    Add GetConsoleWindow to lib/kernel32.def (#32)

commit 1e6e7c6f1ba684cc8de435d169229b87777a4e38
Author: Delyan Angelov <delian66@gmail.com>
Date:   Sun Jan 8 13:31:13 2023 +0200

    add mmreg.h, mmsystem.h, strings.h from gcc

commit 41b40801eea1c7cde26eb51e50dab35a6b8de15b
Author: Delyan Angelov <delian66@gmail.com>
Date:   Wed Dec 28 16:29:41 2022 +0200

    enable compilation of mbedtls using programs with tcc

系统找不到指定的路径。
Cloning vc...
 > Cloning from remote https://github.com/vlang/vc
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), 960.99 KiB | 798.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.

Building V...
 > Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with "thirdparty/tcc/tcc.exe"
 > Compiling "./v.exe" with "./v_win_bootstrap.exe"
V panic: substr(4, 0) out of bounds (len=0)
v hash: b5f71df
print_backtrace_skipping_top_frames is not implemented
'where' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
 > Clang not found
'where' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
 > GCC not found
 > Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with MSVC
v_win.c
vc/v_win.c(496): fatal error C1189: #error:  VERROR_MESSAGE The C compiler can not find <inttypes.h>. Please install build-essentials
In some cases, compile errors happen because of the MSVC compiler version
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30152 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

Backend compiler error

Exiting from error
ERROR: please follow the instructions in https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows

W:\v>

Possible Solution

No response

Additional Information/Context

Both prebuild and manual installation crashed,

Which I have tried:

  1. git clone https://github.com/vlang/v and build it;
  2. use weekly.2023.39 prebuild or download src and build it;
  3. use v-0.4.1_2 prebuild or download src and build it;
    None of them is available, all crashed.

All of crash caused by V panic: substr(4, 0) out of bounds (len=0)

There is another issue,
The make.bat use where to detect GCC or Clang, it caused detect GCC failed even I have already added "mingw/bin" into PATH,
So I deleted GCC detect code below, and built using GCC, still crashed, same issue:

:gcc_strap
where /q gcc
if %ERRORLEVEL% NEQ 0 (
	echo  ^> GCC not found
	if not [!compiler!] == [] goto :error
	goto :msvc_strap
)

GCC can build v_win_bootstrap.exe, after that crashed

W:\v>.\make.bat
Updating TCC
 > Syncing TCC from https://github.com/vlang/tccbin

Updating vc...
 > Sync with remote https://github.com/vlang/vc

Building V...
 > Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with "thirdparty/tcc/tcc.exe"
 > Compiling "./v.exe" with "./v_win_bootstrap.exe"
V panic: substr(4, 0) out of bounds (len=0)
v hash: b5f71df
print_backtrace_skipping_top_frames is not implemented
'where' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
 > Clang not found
 > Attempting to build "./v_win_bootstrap.exe" (from v_win.c) with GCC
 > Compiling "./v.exe" with "./v_win_bootstrap.exe"
V panic: substr(4, 0) out of bounds (len=0)
v hash: b5f71df
print_backtrace_skipping_top_frames is not implemented

Backend compiler error

Exiting from error
ERROR: please follow the instructions in https://github.com/vlang/v/wiki/Installing-a-C-compiler-on-Windows

V version

I have tried newest code by git clone,
and also tried newest prebuild release(weekly.2023.39) and old release(0.4.1_2), try both binary or build it from source.

Environment details (OS name and version, etc.)

Windows10 2004 x64
Hardware Ryzen7 1700x

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.Install/first impressionsBugs/feature requests, that are related to the first impressions that users have of V.Modules: osBugs/feature requests, that are related to the `os` module.OS: WindowsBugs/feature requests, that are specific to Windows OS.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions