eggdrop icon indicating copy to clipboard operation
eggdrop copied to clipboard

Fix clobbered var

Open michaelortmann opened this issue 4 years ago • 0 comments

Found by: michaelortmann Patch by: michaelortmann Fixes:

One-line summary: fix clobbered var

Additional description (if needed): found with gcc-12 and CFLAGS -O1 -Wclobbered -ftrivial-auto-var-init=pattern

Test cases demonstrating functionality (if applicable): Before:

/home/michael/opt/gcc-12-20211017/bin/gcc -O1 -Wclobbered -ftrivial-auto-var-init=pattern -pipe -Wall -I.. -I..  -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -c net.c
net.c: In function ‘setsockname’:
net.c:140:7: warning: variable ‘pref’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
  140 |   int pref;
      |       ^~~~

After: /home/michael/opt/gcc-12-20211017/bin/gcc -O1 -Wclobbered -ftrivial-auto-var-init=pattern -pipe -Wall -I.. -I.. -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS -c net.c

michaelortmann avatar Oct 21 '21 03:10 michaelortmann