473,804 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request

As a consequence of a heavy discussion in another thread,
I wrote this program:
#include <stdlib.h>
int main(void)
{
char *p=calloc(65521 ,65552);
if (p)
printf("BUG!!!! \n");
}

The multiplication will give an erroneus result
in 32 bit size_t systems. I have tested this
in several systems with several compilers.

Maybe people with other compilers/implementations
would compile this program and send the results?

The results I have so far are:

LINUX
GCC 2.95
HAS THE BUG

GCC-4.02
NO BUGS

GCC-3.x
NO BUGS

WINDOWS
cygwin gcc 3.4.4
NO bugs
pelles c:
HAS THE BUG
Microsoft
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
NO BUGS (If the multiplication overflows it will trap. Very good
behavior)

AIX
IBM-cc (compiling in 32 bit mode)
NO BUGS
gcc 4.0.0 (compiling in 32 bit mode)
NO BUGS
Thanks in advance for your cooperation

Jan 2 '07
149 4313

"CBFalconer " <cb********@yah oo.comwrote in message
news:45******** *******@yahoo.c om...
alex bodnaru wrote:
CBFalconer wrote:
"David T. Ashley" wrote:

... snip ...

54135^2 is going to be on the order of 2.5G. That is a pretty
fair hunk of memory.

---------

[nouser@pamc ~]$ cat test3.c
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
char *p;
int i;

for (i=65535; i>0; i--)
{
if (p = calloc(i,i))
{
printf("%d is apparently the largest integer that will
succeed.\n",
>i);
break;
}
}
}
[nouser@pamc ~]$ gcc test3.c
[nouser@pamc ~]$ ./a.out
54135 is apparently the largest integer that will succeed.
[nouser@pamc ~]$

With DJGPP 2.03 (specifies the library) that crashes immediately in
memset. With nmalloc linked in in place of the library it yields
23093.

Advisory cross-post to comp.os.msdos.d jgpp, f'ups set to clc.
even the first malloc is 4gb, and i doubt you have more ;-)

Which should simply fail. The code is looking for the largest
assignable value and for foulups in the calloc multiply operation.
It shouldn't crash. nmalloc fails and returns NULL. DJGPP malloc
claims to succeed, but doesn't, and the memset crashes. This also
shows the need to include calloc in the nmalloc package, to ensure
the same limits are observed.

Why did you override the follow-up I had set? And top-post.
Please go to comp.lang.c for further general discussion of this.
Meanwhile, be aware of the DJGPP bug.
http://groups.google.com/group/comp....f8224d28?hl=en

Chuck,

1) you've encourage DJGPP (and c.l.c) users to use nmalloc for a few years
with little response
2) you never built DJGPP demand for nmalloc by submitting it to the DJGPP
archives
3) since you've said your health isn't good, you could've asked if someone
on comp.os.msdos.d jgpp was willing to prepare and submit nmalloc to the
DJGPP archives for you, but you haven't
4) DJ has never publicly responded to your posts on nmalloc...
5) although you believe in nmalloc, you've never bothered to ask DJ why he's
shown zero interest in nmalloc... Without asking, you'll never know if it
was something simple holding back nmalloc.

Just how serious are you about getting nmalloc into the DJGPP archives or
the DJGPP C library?
Rod Pemberton
PS. Sent to both groups...
Jan 5 '07 #101

"Rod Pemberton" <do*********@bi tfoad.cmmwrites :
2) you never built DJGPP demand for nmalloc by submitting it to the DJGPP
archives
He did, there were some buglets that needed tweaking long ago, it's
probably just waiting for someone with write access to review it and
put it in place. Plus backward compatibility (the malloc debug
interface) and all that.
4) DJ has never publicly responded to your posts on nmalloc...
Dude, go WAY back in the djgpp-workers mail archives.
Jan 5 '07 #102
Ben Pfaff wrote:
Mark McIntyre <ma**********@s pamcop.netwrite s:
.... snip ...
>>
It still doesn't follow. The pointer returned by malloc need not
be a complete absolute reference. Magic can go on behind the
scenes, much as it did with 16-bit pointers used to reference
20-bit memory.

I assume you're speaking of the segmented 16-bit x86 architecture
as featured in MS-DOS compilers. The object pointers used by
these compilers in some modes were 16 bits wide, and they could
only address 64 kB worth of data. You could use
implementation-specific extensions to address more than 16 kB of
memory, or you could switch your compiler to a mode where
pointers were 32 bits long, but there was no way to address more
than 64 kB of objects with 16-bit pointers and without using C
extensions.
Turbo C 2.01 says the following. In that mode (with some other
options set) I can simply compile virtually any standard C source.
Things will be unwell if the object code exceeds 64 k, but I can
put up with that. near and far are just things the compiler does
internally.

"Compact model: This model has 64K for code, 64K
for stack and static data, and up to 1 MB for
the heap. All functions are near by default and
all data pointers are far by default."

I suspect that this may blow up if function pointer are converted
to void * and back again. However that is standard conforming.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #103
jacob navia wrote:
>
.... snip ...
>
Obviously each 16 bit pointer could address only 64K!!!
Mr McIntyre has strong hallucinations when he supposes that
you can have more than 64K with 16 bit pointers!
Emulating Dan Pops tact again?

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #104
Richard Heathfield wrote:
>
.... snip ...
>
Many people were oppressed by King Henry VII. More suffered under
King Henry VIII.
<OT>
That may also reflect the world population at the time, and the
available oppression methods. The shrubish leader has exceeded
both, IMO. I suspect Adolph Schickelgruber holds the record.

Record candidates should include Genghis Khan, Napoleon,
Robespierre, Stalin, Cromwell, Queen Mary I, Mao, all spammers,
various Czars, Popes, and Roman Emperors. Maybe the results should
be normallized to world population at the time of oppression.
</OT>

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #105
in 713360 20070105 054050 CBFalconer <cb********@yah oo.comwrote:
>Richard Heathfield wrote:
>>
.... snip ...
>>
Many people were oppressed by King Henry VII. More suffered under
King Henry VIII.

<OT>
That may also reflect the world population at the time, and the
available oppression methods. The shrubish leader has exceeded
both, IMO. I suspect Adolph Schickelgruber holds the record.

Record candidates should include Genghis Khan, Napoleon,
Robespierre, Stalin, Cromwell, Queen Mary I, Mao, all spammers,
various Czars, Popes, and Roman Emperors. Maybe the results should
be normallized to world population at the time of oppression.
</OT>
So Adam pushing Eve around would be top of the list?
Jan 5 '07 #106
Bob Martin said:
in 713360 20070105 054050 CBFalconer <cb********@yah oo.comwrote:
>>Richard Heathfield wrote:
>>>
.... snip ...
>>>
Many people were oppressed by King Henry VII. More suffered under
King Henry VIII.

<OT>
That may also reflect the world population at the time, and the
available oppression methods. The shrubish leader has exceeded
both, IMO. I suspect Adolph Schickelgruber holds the record.

Record candidates should include Genghis Khan, Napoleon,
Robespierre , Stalin, Cromwell, Queen Mary I, Mao, all spammers,
various Czars, Popes, and Roman Emperors. Maybe the results should
be normallized to world population at the time of oppression.
</OT>

So Adam pushing Eve around would be top of the list?
Other way round. :-)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jan 5 '07 #107
Richard Heathfield wrote:
Bob Martin said:
>CBFalconer <cb********@yah oo.comwrote:
>>Richard Heathfield wrote:

.... snip ...

Many people were oppressed by King Henry VII. More suffered under
King Henry VIII.

<OT>
That may also reflect the world population at the time, and the
available oppression methods. The shrubish leader has exceeded
both, IMO. I suspect Adolph Schickelgruber holds the record.

Record candidates should include Genghis Khan, Napoleon,
Robespierre , Stalin, Cromwell, Queen Mary I, Mao, all spammers,
various Czars, Popes, and Roman Emperors. Maybe the results should
be normallized to world population at the time of oppression.
</OT>

So Adam pushing Eve around would be top of the list?

Other way round. :-)
If we count Cain and Abel in either case they achieved a NOL
(normallized oppression level) of 25%. And they are tied by Cain.
Maybe we should limit the field to recorded history. Bible
thumpers can opt-out. Or, if we include a factor for the QOO
(quality of oppression) Cain 'wins' since his QOO is 1.0.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #108
CBFalconer <cb********@yah oo.comwrites:
Ben Pfaff wrote:
>Mark McIntyre <ma**********@s pamcop.netwrite s:
... snip ...
>>>
It still doesn't follow. The pointer returned by malloc need not
be a complete absolute reference. Magic can go on behind the
scenes, much as it did with 16-bit pointers used to reference
20-bit memory.

I assume you're speaking of the segmented 16-bit x86 architecture
as featured in MS-DOS compilers. The object pointers used by
these compilers in some modes were 16 bits wide, and they could
only address 64 kB worth of data. You could use
implementati on-specific extensions to address more than 16 kB of
memory, or you could switch your compiler to a mode where
pointers were 32 bits long, but there was no way to address more
than 64 kB of objects with 16-bit pointers and without using C
extensions.

Turbo C 2.01 says the following. In that mode (with some other
options set) I can simply compile virtually any standard C source.
Things will be unwell if the object code exceeds 64 k, but I can
put up with that. near and far are just things the compiler does
internally.

"Compact model: This model has 64K for code, 64K
for stack and static data, and up to 1 MB for
the heap. All functions are near by default and
all data pointers are far by default."

I suspect that this may blow up if function pointer are converted
to void * and back again. However that is standard conforming.
I don't think this contradicts anything I wrote. The compact
model uses 32-bit object pointers, like I said. Function
pointers are different and need not have the same form.
--
"When in doubt, treat ``feature'' as a pejorative.
(Think of a hundred-bladed Swiss army knife.)"
--Kernighan and Plauger, _Software Tools_
Jan 5 '07 #109
Ben Pfaff wrote:
CBFalconer <cb********@yah oo.comwrites:>
>Ben Pfaff wrote:
>>Mark McIntyre <ma**********@s pamcop.netwrite s:
... snip ...
>>>>
It still doesn't follow. The pointer returned by malloc need not
be a complete absolute reference. Magic can go on behind the
scenes, much as it did with 16-bit pointers used to reference
20-bit memory.

I assume you're speaking of the segmented 16-bit x86 architecture
as featured in MS-DOS compilers. The object pointers used by
these compilers in some modes were 16 bits wide, and they could
only address 64 kB worth of data. You could use
implementatio n-specific extensions to address more than 16 kB of
memory, or you could switch your compiler to a mode where
pointers were 32 bits long, but there was no way to address more
than 64 kB of objects with 16-bit pointers and without using C
^^^^^^^^^^^^^^^
>>extensions.
^^^^^^^^^^
>>
Turbo C 2.01 says the following. In that mode (with some other
options set) I can simply compile virtually any standard C source.
Things will be unwell if the object code exceeds 64 k, but I can
put up with that. near and far are just things the compiler does
internally.

"Compact model: This model has 64K for code, 64K
for stack and static data, and up to 1 MB for
the heap. All functions are near by default and
all data pointers are far by default."

I suspect that this may blow up if function pointer are converted
to void * and back again. However that is standard conforming.

I don't think this contradicts anything I wrote. The compact
model uses 32-bit object pointers, like I said. Function
pointers are different and need not have the same form.
And my point is that no C extensions are needed. Just feed it
portable standard code. I primarily use it to check I haven't
inadverdently relied on an int size larger than 16 bits.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 6 '07 #110

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2201
by: Jack | last post by:
Hi, I am trying to get a thorough understanding of a code where a addition or deletion of records can be done from a list of records. For addition part of the form, data is being obtained from set of input boxes. The following is the code being used: If Len(Request.Form("ID_0"))>0 Then AuthorID=Request.Form("ID_0") FName=Request.Form("fName_0") LName=Request.Form("lName_0")
4
2885
by: SP | last post by:
Hi I have a problem with a customer's XML being submitting to me in a non-well-format XML. They said that there are 18 other partners who has been able to tweak the XML to make it work. So I guess here is my question, in ASP, when working with XML, how do you handle non-well-formed XML documents on the "listener" response side? Here's the scenerio: Customer post XML Data to us (non-well-formed XML)
7
4148
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge is how to corelate the response to a corresponding request. I am looking for a sure proof threadsafe way to corelate a response to a coresponding request message. Two things that concerns me:-
4
1580
by: Nalaka | last post by:
Hi, I have some request specific data that gets created in a "early event", that I need to pass around to many other events. I need access to this data during that request. (and more importantly disapears after the request is completed). But... asp.net "Request" is read only. Is there a request specific global place, where I can put this data into?
5
20090
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great with Firefox,but with IE6 the onFailure never gets called and the request never completes. My code: var ajaxReq = new Ajax.Request( url, {method: 'post', parameters:
4
3772
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at the end of the loop and the value of x3 as not all options may be selected from the form yet the loop goes through the entire request.form list I have to add addtional code to strip off the last "and" and was wondering if there is a way to...
6
4984
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am using Ajax. kindly advice me.
2
6311
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata enctype="multipart/form-data" method="post" name="testform">
5
6138
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
3
1773
by: Joseph Geretz | last post by:
I'm using the Request Filter documentation which can be found here: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx In this example, two filters are installed, one filter uppercases every alphabetic character and then the second filter replaces every 'E' with "#'. OK, very nice. What's trivial about these examples is that the returned string is exactly the same length as the string which is actually read...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.