Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Sex, Drugs & Linux Rules -- MaDsen Wikholm, mwikholm@at8.abo.fi


devel / comp.lang.c / Re: Probably -flto problem

SubjectAuthor
* Probably -flto problemaotto1968
`* Re: Probably -flto problemBen Bacarisse
 `- Re: Probably -flto problemaotto1968

1
Probably -flto problem

<tu1mar$198tj$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24901&group=comp.lang.c#24901

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: aotto1...@t-online.de (aotto1968)
Newsgroups: comp.lang.c
Subject: Probably -flto problem
Date: Sun, 5 Mar 2023 10:10:50 +0100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <tu1mar$198tj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 5 Mar 2023 09:10:51 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="47a12c5d6853faf72ece9ea45143e97c";
logging-data="1352627"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4BmnROR6/wJV6lzGKC9TPBawTQwivSCw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Cancel-Lock: sha1:19AtpXefcYQqS9e9KjIqvx6O6ws=
Content-Language: en-US
 by: aotto1968 - Sun, 5 Mar 2023 09:10 UTC

Hi,

I start using -flto and compile SQLite Amalgamation. I get the following error:

..../sqlite3.c|124103| warning: function may return address of local variable [-Wreturn-local-addr]
|| 124103 | return pNew;
|| |
..../sqlite3.c|124063| note: declared here
|| 124063 | Select standin;
|| |

If I look into the code I see:

SQLITE_PRIVATE Select *sqlite3SelectNew(...) {
Select standin;
...
assert( pNew!=&standin );
return pNew;
}

As you see the case "function may return address of local variable" is already protected by an "assert"

dear AO

Re: Probably -flto problem

<87a60ro10a.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24904&group=comp.lang.c#24904

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Probably -flto problem
Date: Sun, 05 Mar 2023 12:07:01 +0000
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <87a60ro10a.fsf@bsb.me.uk>
References: <tu1mar$198tj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="6e8b6b46a556828f51fd833fd0fa88cf";
logging-data="1404609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bARYmn5JvhzWUEmDoPhXlwrPLA7q+FpY="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:whKdIXOtnxYwLyEOJTQZx038zLE=
sha1:9YcBZoSJsvS1SJwJaPtN/+0Qw2A=
X-BSB-Auth: 1.ef7a2ba36394a9566be6.20230305120701GMT.87a60ro10a.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 5 Mar 2023 12:07 UTC

aotto1968 <aotto1968@t-online.de> writes:

> I start using -flto and compile SQLite Amalgamation.

If you said what version, readers could try it out. Neither version I
have to hand has the same source for that function.

> I get the following error:
>
> .../sqlite3.c|124103| warning: function may return address of local variable [-Wreturn-local-addr]
> || 124103 | return pNew;
> || |
> .../sqlite3.c|124063| note: declared here
> || 124063 | Select standin;
> || |
>
> If I look into the code I see:
>
> SQLITE_PRIVATE Select *sqlite3SelectNew(...) {
> Select standin;
> ...
> assert( pNew!=&standin );
> return pNew;
> }
>
> As you see the case "function may return address of local variable" is
> already protected by an "assert"

The warning is correct (at least from the sketch you show) because the
assert may be a no-op. You can disable it, if you prefer not to see it.

--
Ben.

Re: Probably -flto problem

<tu2lvs$1dd4b$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24919&group=comp.lang.c#24919

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: aotto1...@t-online.de (aotto1968)
Newsgroups: comp.lang.c
Subject: Re: Probably -flto problem
Date: Sun, 5 Mar 2023 19:11:08 +0100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <tu2lvs$1dd4b$1@dont-email.me>
References: <tu1mar$198tj$1@dont-email.me> <87a60ro10a.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 5 Mar 2023 18:11:09 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="47a12c5d6853faf72ece9ea45143e97c";
logging-data="1488011"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oPBxq1/NUJYqGMC4yH4tFHTPmTZYt+r0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Cancel-Lock: sha1:PKv87hjNSiovZTtkkX0aPJ1rcp4=
In-Reply-To: <87a60ro10a.fsf@bsb.me.uk>
Content-Language: en-US
 by: aotto1968 - Sun, 5 Mar 2023 18:11 UTC

Hi, the missing information

On 05.03.23 13:07, Ben Bacarisse wrote:
> aotto1968 <aotto1968@t-online.de> writes:
>
>> I start using -flto and compile SQLite Amalgamation.
>
> If you said what version, readers could try it out. Neither version I
> have to hand has the same source for that function.
>
>> I get the following error:
>>
>> .../sqlite3.c|124103| warning: function may return address of local variable [-Wreturn-local-addr]
>> || 124103 | return pNew;
>> || |
>> .../sqlite3.c|124063| note: declared here
>> || 124063 | Select standin;
>> || |
>>
>> If I look into the code I see:
>>
>> SQLITE_PRIVATE Select *sqlite3SelectNew(...) {
>> Select standin;
>> ...
>> assert( pNew!=&standin );
>> return pNew;
>> }
>>
>> As you see the case "function may return address of local variable" is
>> already protected by an "assert"
>
> The warning is correct (at least from the sketch you show) because the
> assert may be a no-op. You can disable it, if you prefer not to see it.
>

OK, the assert can GO but the "assert" is at least a signal that "pNew!=&standin" is the "normal"
behavior. The reason for this post is more that the GCC analyzer does NOT use the "assert" to get
better analyses-results → this is probably an open point for future design improvements.

1. There is also an issue in GO → https://github.com/mattn/go-sqlite3/issues/822
2. sqlite-amalgamation-3260000
3. > gcc -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Ziel: x86_64-suse-linux
Konfiguriert mit: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64
--libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit
--enable-offload-targets=nvptx-none,amdgcn-amdhsa, --enable-offload-defaulted --without-cuda-driver --enable-host-shared
--enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/12 --enable-ssp --disable-libssp
--disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id
--enable-linux-futex --enable-gnu-indirect-function --program-suffix=-12 --without-system-libunwind --enable-multilib
--with-arch-32=x86-64 --with-tune=generic --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=x86_64-suse-linux
--host=x86_64-suse-linux
Thread-Modell: posix
Unterstützte LTO-Kompressionsalgorithmen: zlib zstd
gcc-Version 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27] (SUSE Linux)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor