Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 172421
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Linux bug wranglers <bug-wranglers@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Anssi Gröhn <entity@iki.fi>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
box.3ds A valid 3ds file representing a regular, yet very uninteresting, box. application/octet-stream Anssi Gröhn 2007-03-30 07:21 0000 595 bytes Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 172421 depends on: Show dependency tree
Bug 172421 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-03-27 15:01 0000
The gcc-4.1 uses optimizations which break the version 1.2.0 of lib3ds
when compiled with higher than -O0. 

Reproducible: Always

Steps to Reproduce:
1. add -O2 to CFLAGS in /etc/make.conf
2. emerge lib3ds 
3. 3dsdump ./path/to/validfile.3ds
4. values (vertices) after each "point list:" are zeroes.
eg. 
....
 point list:
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000
....
Actual Results:  
Values in the dump were:
---clip---
 point list:
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000
    0.000000 0.000000 0.000000

----clip----

Expected Results:  
1. add -O2 to CFLAGS in /etc/make.conf
2. emerge lib3ds 
3. 3dsdump ./path/to/validfile.3ds
4. values (vertices) after each "point list:" contain also other values than
zeroes. 
eg.
---clip---
point list:
    0.518930 -4.385780 3.989722
    0.418113 -4.384385 3.964804
    0.409068 -4.404268 3.972737
    0.447289 -4.366141 3.958578
    0.490817 -4.353148 3.955289
---clip---

The work-around should at least revert -O{123} optimization flag to -O0.

------- Comment #1 From SpanKY 2007-03-30 06:04:06 0000 -------
post a valid .3ds file for us to test with

------- Comment #2 From Anssi Gröhn 2007-03-30 07:21:52 0000 -------
Created an attachment (id=114913) [details]
A valid 3ds file representing a regular, yet very uninteresting, box.

------- Comment #3 From SpanKY 2007-03-31 03:11:11 0000 -------
not a bug in the toolchain, lib3ds violates strict aliasing rules

building it with '-O3 -fno-strict-aliasing' "fixes" things for me

------- Comment #4 From SpanKY 2007-03-31 03:20:15 0000 -------
looking at the code showed this should be pretty easy to fix so i did:
...
-  return(*((Lib3dsFloat*)&d));
+  memcpy(&ret, &d, sizeof(ret));
+  return ret;
...
-  d=*((Lib3dsDword*)&l);
+  memcpy(&d, &l, sizeof(d));
...

------- Comment #5 From SpanKY 2007-03-31 03:25:50 0000 -------
looks like upstream cvs has fixed the read function but not the write ... filed
bug report upstream

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug