• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Do you know COBOL...opportunities await

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
Bugs in a modern C compiler? Unlikely.
What universe are you living in? I have personally found bugs in every single C compiler I have ever used. Some are so bad they'll make an anthill blush.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
I know. I'm just being difficult. I hate poorly written and documented code, so I take whatever chance I get to bitch about it.
And you're bitching about Linux, of all things. That's some the cleanest and best documented code I've ever seen. It's not perfect, sure, but if that's what you consider bad, I'd (again) like to know what universe you're from.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
Fortunately, compcert exists.
Unfortunately, compcert doesn't implement the full C standard (or didn't last I checked). There's also no guarantee that their formal language specification is actually correct.
 

blueone

Major Contributor
Forum Donor
Joined
May 11, 2019
Messages
1,196
Likes
1,551
Location
USA
What universe are you living in? I have personally found bugs in every single C compiler I have ever used. Some are so bad they'll make an anthill blush.

The universe where I haven't seen or heard of many in C, in multiple million line ++ system software projects.
 

blueone

Major Contributor
Forum Donor
Joined
May 11, 2019
Messages
1,196
Likes
1,551
Location
USA
And you're bitching about Linux, of all things. That's some the cleanest and best documented code I've ever seen. It's not perfect, sure, but if that's what you consider bad, I'd (again) like to know what universe you're from.

You're an advocate of GOTO statements?
 

q3cpma

Major Contributor
Joined
May 22, 2019
Messages
3,060
Likes
4,420
Location
France
Unfortunately, compcert doesn't implement the full C standard (or didn't last I checked). There's also no guarantee that their formal language specification is actually correct.
Code:
CompCert C supports all of ISO C 99, with the following exceptions:
* switch statements must be structured as in MISRA-C; unstructured "switch", as in Duff's device, is not supported.
* longjmp and setjmp are not guaranteed to work.
* Variable-length array types are not supported.
Consequently, CompCert supports all of the MISRA-C 2004 subset of C, plus many features excluded by MISRA (such as recursive functions and dynamic heap memory allocation).

Several extensions to ISO C 99 are supported:
*The _Alignof operator and the _Alignas attribute from ISO C2011.
*Pragmas and attributes to control alignment and section placement of global variables, as well as layout of structs.
*Built-in functions to give access to some processor-specific instructions.
Those unimplemented features being quite discouraged for good reasons, I'm not bothered, personally. But if you want more proven stuff, there's Ada/SPARK or CakeML.
I still use C with Tcl/Tk for stuff I do myself, though.
 

blueone

Major Contributor
Forum Donor
Joined
May 11, 2019
Messages
1,196
Likes
1,551
Location
USA
Only fools blindly parrot Dijkstra without understand that goto has its (tiny) place in some situations.

Thanks for calling me a fool. You're on ignore.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
The universe where I haven't seen or heard of many in C, in multiple million line ++ system software projects.
When you come across a compiler bug, you have two choices: report it and wait for a fix or work around it in your code. If you hope to release your product any time soon, you'll be opting for the latter (fixes can take years to arrive). That's why large, mature software projects don't tend to trigger many bugs in their primary compiler. If you dump a multi-million line code base on a new compiler, you're quite likely to run into some problems.
 

blueone

Major Contributor
Forum Donor
Joined
May 11, 2019
Messages
1,196
Likes
1,551
Location
USA
When you come across a compiler bug, you have two choices: report it and wait for a fix or work around it in your code. If you hope to release your product any time soon, you'll be opting for the latter (fixes can take years to arrive). That's why large, mature software projects don't tend to trigger many bugs in their primary compiler. If you dump a multi-million line code base on a new compiler, you're quite likely to run into some problems.

Haven't in C. In C++, yes, though mostly with libraries, and often because they do things you're not expecting, like forking a thread.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
Code:
CompCert C supports all of ISO C 99, with the following exceptions:
* switch statements must be structured as in MISRA-C; unstructured "switch", as in Duff's device, is not supported.
* longjmp and setjmp are not guaranteed to work.
* Variable-length array types are not supported.
Consequently, CompCert supports all of the MISRA-C 2004 subset of C, plus many features excluded by MISRA (such as recursive functions and dynamic heap memory allocation).

Several extensions to ISO C 99 are supported:
*The _Alignof operator and the _Alignas attribute from ISO C2011.
*Pragmas and attributes to control alignment and section placement of global variables, as well as layout of structs.
*Built-in functions to give access to some processor-specific instructions.
Those unimplemented features being quite discouraged for good reasons, I'm not bothered, personally.
Oh, good. They've filled in most of the gaps now. I'd still be surprised if their formal models of the language and target machines are perfect, though.
 

Soniclife

Major Contributor
Forum Donor
Joined
Apr 13, 2017
Messages
4,517
Likes
5,442
Location
UK
What universe are you living in? I have personally found bugs in every single C compiler I have ever used. Some are so bad they'll make an anthill blush.
To be fair I found bugs in the IBM COBOL compiler, I wonder if they ever fixed them.
 

Soniclife

Major Contributor
Forum Donor
Joined
Apr 13, 2017
Messages
4,517
Likes
5,442
Location
UK
Oh no, we don't need no stinking comments.
Say what you want about COBOL, but the code often comes from an era when code reviews were done by technical team leaders who had standards for code, comments and quality, plus COBOL could be made to almost read like English with a bit of work, if you were a bit weird.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
Haven't in C. In C++, yes, though mostly with libraries, and often because they do things you're not expecting, like forking a thread.
Then you must have led a fairly sheltered life. Compiler bugs are real. Get over it.
 

blueone

Major Contributor
Forum Donor
Joined
May 11, 2019
Messages
1,196
Likes
1,551
Location
USA
They you must have led a fairly sheltered life. Compiler bugs are real. Get over it.

I just love forum conversations, they always make annoying chores like cleaning the garage floor look so much more palatable. I probably asked for this nonsense with a few off-the-cuff comments, but I've learned my lesson. I'll go back to my universe.
 

q3cpma

Major Contributor
Joined
May 22, 2019
Messages
3,060
Likes
4,420
Location
France
Oh, good. They've filled in most of the gaps now. I'd still be surprised if their formal models of the language and target machines are perfect, though.
The language shouldn't be too hard, C's spec isn't ridiculously complex unlike C++ or other "modern" languages. The targets, though, might be trickier; especially something like x86 where some important semantics like the memory ordering model isn't clearly documented. Or where proprietary microcode, backdoor through ring -3 coprocessors and stuff like SMM really control what's happening. I'd trust it more for ARM.
 

Soniclife

Major Contributor
Forum Donor
Joined
Apr 13, 2017
Messages
4,517
Likes
5,442
Location
UK
You're an advocate of GOTO statements?
I do take a perverse pleasure in the use of the odd GOTO, when I know the code is going to be reviewed (never happens these days) by a pedant, if I can find a place to use one where the alternative is ugly or unmaintainable.
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,685
Likes
10,705
Location
Hampshire
The language shouldn't be too hard, C's spec isn't ridiculously complex unlike C++ or other "modern" languages. The targets, though, might be trickier; especially something like x86 where some important semantics like the memory ordering model isn't clearly documented. Or where proprietary microcode, backdoor through ring -3 coprocessors and stuff like SMM really control what's happening. I'd trust it more for ARM.
Modern ARM is also pretty darned complex. It would be interesting to see what could be done with a CPU architecture designed from the ground up using formal specs.
 
Top Bottom