Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Brantley Coile
Hi Bakul. Long time since our Bay Area plan 9 hacking sessions. I've avoided the valley all together for a year and a half now. Not quite long enough yet. I thought the same thing, using ~0 for nil, but realized two things. First, that's a valid address on the PDP11 where the convention

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread tlaronde
On Thu, Nov 26, 2015 at 06:22:45AM -0500, Brantley Coile wrote: > > I thought the same thing, using ~0 for nil, but realized two things. First, > that's a valid address on the PDP11 where the convention developed. It's the > unibus space. Second, ~0 + member offest is still in page zero. >

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Bruce Ellis
Simple data share in Inferno. Define a struct with a single byte in it. Now with b == nil throw in a b.data = 42. Visible channel to every process. This requires 0xF zillion to be writeable. On 26 November 2015 at 22:22, Brantley Coile wrote: > Hi Bakul. Long time since

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 11:37, wrote: > Plus, in C, 0 is used as a truth value for false... > That doesn't say how a 0 value for a pointer is represented; it's just how it's written in the program text. The compiler knows the types and can convert (same as double = 0). In

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
That copy of the compilers was changed quite a bit by someone else, and I only belatedly realised that. I'll try to resurrect that one, since it would help me keep the Plan 9 and Inferno compilers in sync, as well. On 25 November 2015 at 17:24, Vasudev Kamath wrote: >

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 25 November 2015 at 17:10, Vasudev Kamath wrote: > In file included from > /home/vasudev/Documents/C_programming/compilers/9-cc/Linux/386/include/lib9.h:9:0, > from 9obj.c:5: > /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and >

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread David du Colombier
>> In file included from >> /home/vasudev/Documents/C_programming/compilers/9-cc/Linux/386/include/lib9.h:9:0, >> from 9obj.c:5: >> /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and >> _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] >> # warning

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread erik quanstrom
On Thu Nov 26 03:25:34 PST 2015, brantleyco...@me.com wrote: > Hi Bakul. Long time since our Bay Area plan 9 hacking sessions. I've avoided > the valley all together for a year and a half now. Not quite long enough yet. > > I thought the same thing, using ~0 for nil, but realized two things.

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Brantley Coile
Thanks, Erik. And of those, how many don’t end with arrays or would not use earlier members to access those arrays? I’m still kind of dubious that there are any structures where one would not catch a null pointer. Of course, this is not the original issue, which was someone fooling the kernel

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Alexandru Gheorghe
On Nov 26, 2015 6:35 PM, "erik quanstrom" wrote: > > By the way, are there any structs more than 4K in Linux? Are there any in plan 9? > > since that 4k is really pagesz, on amd64 that would be 2mb. there's no compelling reason on > 64-bit machines to start at the bottom

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 16:42, Brantley Coile wrote: > I’m still kind of dubious that there are any structures where one would > not catch a null pointer. > I don't think there are any. In practice, ome other value lower down will be accessed first. Unless the compiler

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread erik quanstrom
aren't there any Biobufs at the start of structures?  I only have a phone here so I can't verify. - erik On Nov 26, 2015 8:50 AM, Charles Forsyth wrote:On 26 November 2015 at 16:42, Brantley Coile wrote:I’m still kind of dubious that there are

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Bakul Shah
Good points! Though 0 was a valid address on pdp11, right? May be if they had used ~0 as nil and not put any peripheral device at that address, *nil would've had more immediate failures! Many ~0+offset errors would be caught on machines that trap 2 or 4 byte fetch/store to odd addresses. I

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Brantley Coile
Hee hee. My comment has more to do with personal experience than a judgment on the area in general. > On Nov 26, 2015, at 12:48 PM, Bakul Shah wrote: > > No comment on the Bay Area :-) Especially since we are trying to hire people!

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Ryan Gonzalez
On November 26, 2015 6:10:43 AM CST, Charles Forsyth wrote: >On 25 November 2015 at 17:10, Vasudev Kamath >wrote: > >> In file included from >> >/home/vasudev/Documents/C_programming/compilers/9-cc/Linux/386/include/lib9.h:9:0, >>

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 18:15, Ryan Gonzalez wrote: > the only library on earth that makes me want to bang my head on the floor. There must be others, surely. What about graphics libraries with APIs designed for FORTRAN (no data structures)? What about ostensible crypto

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Andrew Simmons
> the only library on earth that makes me want to bang my head on the floor. > You need to get out more

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Ryan Gonzalez
On November 26, 2015 3:56:44 PM CST, Charles Forsyth wrote: >On 26 November 2015 at 21:51, Charles Forsyth > >wrote: > >> On 26 November 2015 at 21:49, Ryan Gonzalez wrote: >> >>> All that is bad...but glibc is worse. The

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Ryan Gonzalez
On November 26, 2015 3:31:11 PM CST, Charles Forsyth wrote: >On 26 November 2015 at 18:15, Ryan Gonzalez wrote: > >> the only library on earth that makes me want to bang my head on the >floor. > > >There must be others, surely. What about graphics

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 21:49, Ryan Gonzalez wrote: > All that is bad...but glibc is worse. The issue is that you kinda *have* > to use it, true, very true.

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 21:51, Charles Forsyth wrote: > On 26 November 2015 at 21:49, Ryan Gonzalez wrote: > >> All that is bad...but glibc is worse. The issue is that you kinda *have* >> to use it, > > > true, very true. i remember glibc being my

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread David du Colombier
>> I remember the time I was trying to build LLVM+Clang on Windows in debug >> mode. Because...MinGW...I actually surpassed the file size limit when >> linking Clang, so I had to rebuild EVERYTHING. Stupid thing took about an >> hour each time. > > > Ah. Debug mode. It took me a while to suspect:

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 22:02, Ryan Gonzalez wrote: > I remember the time I was trying to build LLVM+Clang on Windows in debug > mode. Because...MinGW...I actually surpassed the file size limit when > linking Clang, so I had to rebuild EVERYTHING. Stupid thing took about an >

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Steve Simon
I don't know about the PDP but the VAX allowed access to address zero. Even more insidious, it allowed you to dereference a null pointer and guaranteed it would contain a zero, which resulted in many tiresome portability issues - I used Interdatas at the time, which faulted on a read at

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 23:14, Steve Simon wrote: > I don't know about the PDP but the VAX allowed access to address zero. Not in my port.

Re: [9fans] Undefined Behaviour in C

2015-11-26 Thread Brantley Coile
I did a port just like that (DTS Generic Unix) just to see what it would be like. It was awful. I’ll never do that again. > On Nov 26, 2015, at 6:14 PM, Steve Simon wrote: > > > I don't know about the PDP but the VAX allowed access to address zero. > > Even more

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Brantley Coile
Clearly history is wrong. It would never be able to compile C in less than 18MB (1/2 of clang’s text size). Therefor Unix didn’t really happen. It’s all been a phone company conspiracy for world domination, like the NASA not really putting a man on the moon. We were just *told* they had built

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Charles Forsyth
On 26 November 2015 at 23:08, Ryan Gonzalez wrote: > Holy crap, that's crazy. I built it in debug mode on Linux, but I don't > think it used that much. I only have 6 GB right now! You have to remember that a C compiler is one of the largest, most complex software components

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Ryan Gonzalez
On November 26, 2015 5:21:54 PM CST, Charles Forsyth wrote: >On 26 November 2015 at 23:08, Ryan Gonzalez wrote: > >> Holy crap, that's crazy. I built it in debug mode on Linux, but I >don't >> think it used that much. I only have 6 GB right now! >

Re: [9fans] Compiling ken-cc on Linux

2015-11-26 Thread Ryan Gonzalez
On November 26, 2015 4:30:32 PM CST, David du Colombier <0in...@gmail.com> wrote: >>> I remember the time I was trying to build LLVM+Clang on Windows in >debug >>> mode. Because...MinGW...I actually surpassed the file size limit >when >>> linking Clang, so I had to rebuild EVERYTHING. Stupid