简体   繁体   中英

C - Eclipse - “Mixed” dialect and ANSI support crash program?

I've been having a strange issue with C in Eclipse. Right-clicking on my project, I go to Properties, C/C++ Build, Settings, Gcc C Compiler Dialect. In the dropdown menu, by default, there's nothing under Language Standard, and my program runs fine. However, by changing to anything else (C90, C99, or C11), the program crashes when run.

Using the debugger, I looked at the disassembly and got a complaint regarding strln() at some memory address and I'm not sure where to proceed from here.

Here's some assembly:

mov (%ecx),%al
add $0x1,%ecx
test %al,%al
je 0x75234434 <strlen+97>
test $0x3,%ecx
jne 0x752343df <strlen+12>
...

Interestingly, without the dialect specified, by clicking on Miscellaneous, and clicking Support ANSI programs (-ansi) causes the exact same error.

Any and all advice welcome :)

Tracebook as requested:

#0  0x752343df in strlen () from C:\WINDOWS\syswow64\msvcrt.dll
#1  0x0044e2bd in __mingw_pformat ()
#2  0x0044ca5f in __mingw_vfprintf ()
#3  0x00417156 in fprintf (__stream=0x752c2980 <msvcrt!_iob+128>, __format=0x4561dc <__register_frame_info+4547036> "%s %.2lf %s %.0lf %.0lf %.2lf %.2lf %.2lf %.2lf ") at c:/mingw/include/stdio.h:246
#4  0x00418893 in skriv_v_profil (tag=0x809fe8, nasta_stat=..., sign=1, variant=2) at ..\src\kortid.c:314
#5  0x00419d65 in kor_tid (tag=0x809fe8, v2=24.25, smax=452, tmax=100000) at ..\src\kortid.c:642
#6  0x00427fdb in gang_tid (tag=0x809fe8, ret_kod=2, tmax=100000, skriv_g3=0, test_finnsg3=0, t_ack=3030.5876288659802) at ..\src\gangtid.c:2617
#7  0x00403215 in kor_tag (taget=0x809fe8, lanken=0x7cc338, riktning=1, result=0x7da1f8, resflg=7) at ..\src\ttt2gtk.c:702
#8  0x00407ff7 in grenkortag (banap=0x28fd6c, grnidx=0, tagtyp=0x7e6ea0, ttpidx=0, riktn=1, resflg=7, stppl=0x0, resp=0x28fd34) at ..\src\ttt2gtk.c:2405
#9  0x004201b8 in main (argc=11, argv=0x7e1b00) at ..\src\gtb.c:991

Apologies, I missed copying the second half as the window was really small.

I believe I have found the error. One of the variables becomes -1 and highlighted in Eclipse. I have no idea about the details but I think the solution will be very specific and I'll have to find it myself. Thanks to John Bode and WhozCraig for the help, especially regarding the traceback. Life savers, thank you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM