All of lore.kernel.org
 help / color / mirror / Atom feed
* Query regarding sizeof long
@ 2017-01-24 14:23 Dibyendu Majumdar
  2017-01-24 14:47 ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Dibyendu Majumdar @ 2017-01-24 14:23 UTC (permalink / raw)
  To: linux-sparse

Hi

I am working on porting Sparse to Windows, and I noticed that in
64-bit architecture the bits_in_long is set to 64. This is not true
for Windows where long is 32 bits on a 64-bit machine. I was wondering
if I just need to set this parameter to 32 or if there are other
implications that I need to be aware of.

Thanks and Regards
Dibyendu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query regarding sizeof long
  2017-01-24 14:23 Query regarding sizeof long Dibyendu Majumdar
@ 2017-01-24 14:47 ` Luc Van Oostenryck
       [not found]   ` <CACXZuxdGV=VMiVdw7qM-wOzjOXEAV8WAw9KaXM+zpcA1c2RK6w@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-01-24 14:47 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: linux-sparse

On Tue, Jan 24, 2017 at 02:23:13PM +0000, Dibyendu Majumdar wrote:
> Hi
> 
> I am working on porting Sparse to Windows, and I noticed that in
> 64-bit architecture the bits_in_long is set to 64. This is not true
> for Windows where long is 32 bits on a 64-bit machine. I was wondering
> if I just need to set this parameter to 32 or if there are other
> implications that I need to be aware of.

Hi,

If you just change the initial value in target.c, it won't do what you
need because currently, if you compile sparse on a machine where
__x86_64__ is defined, it will automatically enable the -m64 option
which will setup things for an LP64 architecture instead of the LLP64
that you need (inside handle_arch_m64_finalize()).

Ideally, we should have a mean to configure the default value of such
things at building time.

Hope it helps,
Luc 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query regarding sizeof long
       [not found]   ` <CACXZuxdGV=VMiVdw7qM-wOzjOXEAV8WAw9KaXM+zpcA1c2RK6w@mail.gmail.com>
@ 2017-01-24 18:00     ` Luc Van Oostenryck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-01-24 18:00 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: Linux-Sparse

On Tue, Jan 24, 2017 at 4:08 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> Hi Luc,
>
> On 24 January 2017 at 14:47, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
>> On Tue, Jan 24, 2017 at 02:23:13PM +0000, Dibyendu Majumdar wrote:
>>> I am working on porting Sparse to Windows, and I noticed that in
>>> 64-bit architecture the bits_in_long is set to 64. This is not true
>>> for Windows where long is 32 bits on a 64-bit machine. I was wondering
>>> if I just need to set this parameter to 32 or if there are other
>>> implications that I need to be aware of.
>>
>> If you just change the initial value in target.c, it won't do what you
>> need because currently, if you compile sparse on a machine where
>> __x86_64__ is defined, it will automatically enable the -m64 option
>> which will setup things for an LP64 architecture instead of the LLP64
>> that you need (inside handle_arch_m64_finalize()).
>>
>
> Yes I noticed that and I can easily make that conditional on MSVC. I
> guess my question is more whether there are any assumptions in the
> code that a long in a 64-bit environment is 64-bits (e.g. pointers fit
> into long). I have not yet been able to run all the tests on Windows,
> but I guess that is one way I can find out if there are any issues.

There shouldn't be any such assumptions :)
And I think, you shouldn't have much bad surprised,
but I'm a bit less confident regarding the test-suite. It's very possible
that some tests have the assumption that sizeof(long) == sizeof(pointer).
And I'm pretty sure that this LLP64 situation have been very little tested,
very possibly never been tested at all.

Luc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 14:23 Query regarding sizeof long Dibyendu Majumdar
2017-01-24 14:47 ` Luc Van Oostenryck
     [not found]   ` <CACXZuxdGV=VMiVdw7qM-wOzjOXEAV8WAw9KaXM+zpcA1c2RK6w@mail.gmail.com>
2017-01-24 18:00     ` Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.