Le 22/11/2022 à 11:25, Pavel Sanda a écrit :
On Tue, Nov 22, 2022 at 07:49:02AM +0100, Jean-Marc Lasgouttes wrote:
Le 22 novembre 2022 03:04:39 GMT+01:00, Pavel Sanda <sa...@lyx.org> a écrit :
Nice, so now we know the culprit. The question is whether we want
to get rid of reference on the left side or fix the temps on the right.

So what is the issue that the warning detect? I still don't get it.

My interpretation is that gcc is nervous about the temporary created via
getFont which is then propagated to the bottom via chain of refs and it's
not possible for it to decide whether returned value is independent of
that temp.

Note that I'm not claiming that there is some *real* issue (I did not find any),
it's just that we need to shut up that warning.

Another option would be to create MWE and send it to gcc bugzilla,
but I do not have gcc 13 to deliver it.

Looking here, this feature is one month old:
https://patchwork.sourceware.org/project/gcc/patch/20221021232824.1093138-1-pola...@redhat.com/

Maybe is it indeed a false positive, but we do not want to have to cater for that. I would be nervous to have to separate calls to theFontMetrics in two for no good reason.

What I understand, is that it triggers when we store as reference the result of a function that uses a temporary as parameter, with the idea that the reference _might_ depend on the temporary. This feels wrong.

It seems as simple as:
1. theFontMetrics returns a lvalue
2. it uses a parameter that is a temporary
1+2 => the lvalue should not be stored because it may disappear when the temporary is destroyed.

So it might be that it is buggy and will sort itself out magically.

JMarc

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to