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

mbedit_prog.c: operation on ‘*(ping[i].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point] #869

Closed
schwehr opened this issue Jan 21, 2020 · 1 comment · Fixed by #872

Comments

@schwehr
Copy link
Collaborator

schwehr commented Jan 21, 2020

With

gcc (Debian 8.3.0-6) 8.3.0

I see:

gcc -DHAVE_CONFIG_H -I. -I../../src/mbio  -I../../src/mbio -I../../src/mbaux -I../../src/gsf  -I/usr/include    -g -O2 -Wno-format -Wno-stringop-truncation -Wno-stringop-overflow -Wall -Wextra -Wno-sign-compare -Wno-maybe-uninitialized -Wno-format-overflow -MT mbedit_prog.o -MD -MP -MF $depbase.Tpo -c -o mbedit_prog.o mbedit_prog.c &&\
mv -f $depbase.Tpo $depbase.Po
mbedit_prog.c: In function ‘mbedit_action_mouse_restore’:
mbedit_prog.c:1847:28: warning: operation on ‘*(ping[i].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point]
        ping[i].beamflag[j] = ping[i].beamflag[j] = mb_beam_set_flag_none(ping[i].beamflag[j]);
mbedit_prog.c: In function ‘mbedit_filter_ping’:
mbedit_prog.c:3343:32: warning: operation on ‘*(ping[iping].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point]
        ping[iping].beamflag[j] = ping[iping].beamflag[j] = mb_beam_set_flag_filter2(ping[iping].beamflag[j]);
mbedit_prog.c:3364:32: warning: operation on ‘*(ping[iping].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point]
        ping[iping].beamflag[j] = ping[iping].beamflag[j] = mb_beam_set_flag_filter2(ping[iping].beamflag[j]);
mbedit_prog.c:3391:33: warning: operation on ‘*(ping[iping].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point]
         ping[iping].beamflag[j] = ping[iping].beamflag[j] =
mbedit_prog.c:3415:33: warning: operation on ‘*(ping[iping].beamflag + (sizetype)j)’ may be undefined [-Wsequence-point]
         ping[iping].beamflag[j] = ping[iping].beamflag[j] =

e.g. What is this supposed to be? It looks like a = a = mb_beam_set_flag_none(a)

if (!mb_beam_ok(ping[i].beamflag[j]) && !mb_beam_check_flag_unusable(ping[i].beamflag[j]))
    ping[i].beamflag[j] = ping[i].beamflag[j] = mb_beam_set_flag_none(ping[i].beamflag[j]);
@dwcaress
Copy link
Owner

Agreed - it should just be:
ping[i].beamflag[j] = mb_beam_set_flag_none(ping[i].beamflag[j]);

schwehr added a commit to schwehr/MB-System that referenced this issue Jan 22, 2020
-Wsequence-point: may be undefined

Fixes dwcaress#869
schwehr added a commit that referenced this issue Jan 22, 2020
-Wsequence-point: may be undefined

Fixes #869
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants