* bug#35277: 26.1.90; Non-assigned variable used in condition
@ 2019-04-14 17:21 Óscar Fuentes
2019-04-16 3:58 ` Paul Eggert
0 siblings, 1 reply; 2+ messages in thread
From: Óscar Fuentes @ 2019-04-14 17:21 UTC (permalink / raw)
To: 35277
../../emacs/src/widget.c: In function ‘EmacsFrameQueryGeometry’:
../../emacs/src/widget.c:457:29: warning: ‘ok_height’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if ((mask & CWHeight) && (ok_height != request->height))
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../emacs/src/widget.c:455:18: warning: ‘ok_width’ may be used uninitialized in this function [-Wmaybe-uninitialized]
result->width = ok_width;
~~~~~~~~~~~~~~^~~~~~~~~~
I checked that the warnings are legit. With
(setq frame-resize-pixelwise t)
ok_width is used in the `if'. Not ok_height, at least on my experiments,
but removing the warning would be nice.
Note that the warning for `ok_width' points to the assignment, but it is
used right before on the `if'.
In GNU Emacs 26.1.90 (build 2, x86_64-pc-linux-gnu, X toolkit)
of 2019-03-16 built on sky
Repository revision: df7ed10e4f15d3ea8b4426f7721bafe60bf8deeb
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux buster/sid
Recent messages:
Saving file /home/oscar/elisp/emacs.el...
Wrote /home/oscar/elisp/emacs.el
Auto-saving...done
Saving file /home/oscar/dev/emacs/emacs/src/widget.c...
Wrote /home/oscar/dev/emacs/emacs/src/widget.c
Saving file /home/oscar/dev/emacs/emacs/src/widget.c...
Wrote /home/oscar/dev/emacs/emacs/src/widget.c
[C-t] show common commands, [?] describe events, [C-h i] show manual
Saving file /home/oscar/elisp/emacs.el...
Wrote /home/oscar/elisp/emacs.el
Quit
Configured using:
'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid
--with-modules'
Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND GSETTINGS GLIB NOTIFY LIBSELINUX
GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB LUCID X11 XDBE XIM MODULES
THREADS
Important settings:
value of $LANG: C
locale-coding-system: nil
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#35277: 26.1.90; Non-assigned variable used in condition
2019-04-14 17:21 bug#35277: 26.1.90; Non-assigned variable used in condition Óscar Fuentes
@ 2019-04-16 3:58 ` Paul Eggert
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2019-04-16 3:58 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: 35277-done
[-- Attachment #1: Type: text/plain, Size: 77 bytes --]
Thanks for reporting that. I installed the attached patch into Emacs master.
[-- Attachment #2: 0001-Fix-uninit-var-in-widget.c.patch --]
[-- Type: text/x-patch, Size: 1621 bytes --]
From debaa72dd89eee0dffc930a7ccff742ca5a81d88 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 15 Apr 2019 20:53:13 -0700
Subject: [PATCH] Fix uninit var in widget.c
* src/widget.c (EmacsFrameQueryGeometry):
Avoid use of uninitialized variables ok_width, ok_height (Bug#35277).
---
src/widget.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/widget.c b/src/widget.c
index 508974dd46..e662dd3ecd 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -434,21 +434,20 @@ EmacsFrameResize (Widget widget)
}
static XtGeometryResult
-EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result)
+EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request,
+ XtWidgetGeometry *result)
{
- EmacsFrame ew = (EmacsFrame) widget;
-
int mask = request->request_mode;
- Dimension ok_width, ok_height;
- if (mask & (CWWidth | CWHeight))
+ if (mask & (CWWidth | CWHeight) && !frame_resize_pixelwise)
{
- if (!frame_resize_pixelwise)
- round_size_to_char (ew,
- (mask & CWWidth) ? request->width : ew->core.width,
- ((mask & CWHeight) ? request->height
- : ew->core.height),
- &ok_width, &ok_height);
+ EmacsFrame ew = (EmacsFrame) widget;
+ Dimension ok_width, ok_height;
+
+ round_size_to_char (ew,
+ mask & CWWidth ? request->width : ew->core.width,
+ mask & CWHeight ? request->height : ew->core.height,
+ &ok_width, &ok_height);
if ((mask & CWWidth) && (ok_width != request->width))
{
result->request_mode |= CWWidth;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-16 3:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-14 17:21 bug#35277: 26.1.90; Non-assigned variable used in condition Óscar Fuentes
2019-04-16 3:58 ` Paul Eggert
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.