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

Warning: ‘memcpy’ specified bound between .... exceeds maximum object size #18738

Open
keypey opened this issue Jul 1, 2023 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@keypey
Copy link

keypey commented Jul 1, 2023

Describe the bug

Compile: v -keepc -prod -show-c-output test1.v

module main
// file:test1.v
import os

fn main() {
    mut i_full_path := os.join_path('/home/user1', 'test.conf')
    println(i_full_path)
}

Produced output with warning:

tmp/v_1000/pa_tech.tmp.c: In function ‘os__join_path_single.isra’:
/tmp/v_1000/pa_tech.tmp.c:13214:10: warning: ‘memcpy’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
13214 |   return memcpy(dest, const_src, n);
      |          ^
/tmp/v_1000/test1.tmp.c: In function ‘print_backtrace_skipping_top_frames_linux.isra’:
/tmp/v_1000/test1.tmp.c:8549:10: warning: ‘memcpy’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
 8549 |   return memcpy(dest, const_src, n);
      |          ^
=================================

Expected Behavior

No warning.

Current Behavior

Produce warning.

Reproduction Steps

Compile source from description.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.5 015ccc2

Environment details (OS name and version, etc.)

Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Linux  5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64 GNU/Linux
@keypey keypey added the Bug This tag is applied to issues which reports bugs. label Jul 1, 2023
@JalonSolov
Copy link
Contributor

Which C compiler do you have? And what version is it?

On Manjaro Linux it works fine with 3 different compilers:

tcc (that comes with V)
gcc (GCC) 13.1.1 20230429
clang version 15.0.7

All 3 work and show the same (expected) output:

$ v run foo.v
/home/user1/test.conf
$ v -cc gcc run foo.v
/home/user1/test.conf
$ v -cc clang run foo.v
/home/user1/test.conf
$

@keypey
Copy link
Author

keypey commented Jul 1, 2023

tcc.exe | tcc version 0.9.27 (x86_64 Linux)

v -keepc -g -showcc -show-c-output test1.v
> C compiler cmd: '/home/bruno/bin/v/thirdparty/tcc/tcc.exe' '@/tmp/v_1000/test1.tmp.c.rsp'
> C compiler response file "/tmp/v_1000/test1.tmp.c.rsp":
  -std=gnu99 -D_DEFAULT_SOURCE -g -o "/home/bruno/W7/Programowanie/v/postgres/test1" -D GC_BUILTIN_ATOMIC=1 -D GC_THREADS=1 -I "/home/bruno/bin/v/thirdparty/libgc/include" "/tmp/v_1000/test1.tmp.c" -bt25 -rdynamic "/home/bruno/bin/v/thirdparty/tcc/lib/libgc.a" -ldl -lpthread  
======== C Compiler output ========

But with gcc:

v -cc gcc -keepc -prod -show-c-output test1.v
======== C Compiler output ========
/tmp/v_1000/test1.tmp.c: In function ‘print_backtrace_skipping_top_frames_linux.isra’:
/tmp/v_1000/test1.tmp.c:8549:10: warning: ‘memcpy’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
 8549 |   return memcpy(dest, const_src, n);
      |          ^

gcc (Debian 10.2.1-6) 10.2.1 20210110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

2 participants