Shading pattern bug with stitching functions

I am using Acrobat Professional 7 for Windows, but I don't believe the situation has changed in Acrobat 9.
I have a simple hand-crafted pdf that is designed to test shading patterns with extend regions when used with stitching (Type 3) functions. These behave according to the spec in most cases, but there is a special case where they don't. I've included the job at the end of this message.
The special case is where a Bounds entry is identical to one of the Domain values. The spec doesn't say what should happen for this case, but I might expect either the end child function would be ignored, or that it is used but the appropriate colour would be evaluated using it and applied to the extend region.
What in fact happens, is that the extend regions have their colour derived from evaluating 0 or 1 through the end child functions. This is true regardless of whether the shading domain includes zero. But, these are used the wrong way round.
This might seem like a specialised case that would never appear in the field from real world application, but that is not the case. I have dozens of such jobs from customers displaying exactly this problem with varying workarounds by producers such as (Agfa Apogee Normalizer), (Acrobat Distiller 6.0 \(Windows\)), (Adobe PDF library 7.77), (Creo Normalizer JTP ver. 3.1.6), (Adobe PDF Library 8.0).
In more detail, the job has one radial shading pattern using a stitching function with 6 child functions. The first child function coincides with the function domain, as do the last two child functions. The domain of the shading is a subset of the stitching function, arranged so that the end child functions should never be evaluated.
I believe the whole of the shading should be a solid cyan because the domain is 0.3 to 0.7. Only one of the child functions covers this range which is solid cyan. Acrobat displays the inner extended region as black which can only be explained by pushing 1 through the first child function, and the outer extended region is yellow which can only be explained by pushing 0 through the final child function.
I believe Acrobat should be using the shading domain limits for the extend regions. Instead, it is using 0 and 1. But worse, the values are being used the wrong way round.
This is my hand-crafted job for testing shading patterns with Type 3 functions. The job is hand crafted, and I haven't gone to the trouble of setting the xref table or setting the stream lengths, but Acrobat does repair the file and it behaves the same as other, real-world, jobs
%PDF-1.4
%âãÏÓ
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Count 1
/Kids [4 0 R ]
>>
endobj
3 0 obj
<< % Info dictionary
/Title (FunctionType 3 boundary test)
/CreationDate (D:20051118000000-00'00')
/Author (John Jefferies)
>>
endobj
4 0 obj
<< % Page 1
/Type /Page
/Parent 2 0 R
/Resources 5 0 R
/MediaBox [0 0 300 300]
/Contents [6 0 R]
>>
endobj
5 0 obj
<< % Resources Groups
/Shading <<
/Radial 7 0 R
>>
/ProcSet [/PDF]
>>
endobj
6 0 obj
<< % Page contents
/Length 1
>>
stream
q 1 0 0 1 0 0 cm /Radial sh Q
endstream
endobj
7 0 obj
<< % Radial shading covering group
/ShadingType 3
/ColorSpace /DeviceCMYK
/BBox [0 0 300 300]
/Coords [150 150 30 150 150 175]
/Function 8 0 R
/Domain [0.3 0.7]
/Extend [true true]
>>
endobj
8 0 obj
<< % Function for shadings
/FunctionType 3
/Domain [0 1]
/Range [0 1 0 1 0 1 0 1]
/Functions [9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R]
/Bounds [0 0.25 0.25 1 1]
/Encode [0 1 0 1 0 1 0 1 0 1 0 1]
>>
endobj
9 0 obj
<< % Function for shadings: Red - Black
/FunctionType 2
/Domain [0 1]
/Range [0 1 0 1 0 1 0 1]
/C0 [0 1 1 0]
/C1 [0 0 0 1]
/N 1
>>
endobj
10 0 obj
<< % Function for shadings: Green
/FunctionType 2
/Domain [0 1]
/Range [0 1 0 1 0 1 0 1]
/C0 [1 0 1 0]
/C1 [1 0 1 0]
/N 1
>>
endob

Philip, thankyou for offering to look at this.
I have attached 'FunctionType 3 boundary.pdf' which was the original file I attempted to post. The file 'AcrOut Domain 0_3-0_7.png' makes it clear what I am seeing in Acrobat. I would also like to augment my original post a little to point out incompatibilities between Acrobat and CPSI.
1. From my PoV, compatibility between Acrobat and CPSI is important, so I've also attached a file that contains equivalent PostScript. On my Ricoh Aficio with CPSI (3016.203) inside it, the job is rendered in solid cyan as I would expect given that the domain of the shading is restricted to [0.3 0.7].
2. If the jobs are changed to make the shading domain [0 1] instead of [0.3 0.7], Acrobat displays a green ring (expected), and the inner extend region is now red (expected). The outer extend region remains yellow.
CPSI renders the job almost the same as Acrobat, but the outer extend region is painted in cyan, not yellow. An Nth reading of the PDF and PS specs has revealed a subtle difference; there is one sentence in the stitching function section of the PDF spec not present in the PS spec, it is "If the last bound, Bounds(k−2) , is equal to Domain(1) , then x′ is defined to be Encode(2i)". I take this to mean the outer extends region may have different color in the PDF and PS versions by design.
3. If the pdf job is changed to make the shading domain [0.01 0.99], Acrobat displays the inner extend in black as before (unexpected), otherwise the same as 2).
To summarise:
1. There appears to be a bug in Acrobat whereby it ignores domain of the shading when painting the extend regions.
2. There is an incompatibility between Acrobat and CPSI in the outer extends region when the final Bounds entry is equal to the Domain value. This may be by design.

Similar Messages

  • Bug with min function applied to an attribute?

    Does anyone know if there is a bug with the minimum function when it is applied to an attribute?
    I have Accounts, Date, Sales Type and volume in my request.
    I have applied min(Date) in the fx of the Date column.
    My query is hitting the YAGO table even though non of the columns i am using is mapped onto a YAGO table.
    As a test I've removed the min function frem the Date column and applied it to the Account column.
    Again my query hits the YAGO table.
    Does anyone know if it is a bug or can someone propose a workaround?
    I am using OBIEE version 10.1.3.4.1090414.1922 on Windows XP.

    Hi,
    You can create a separate report and refer it into the column of main report by 'Filter based on results of another request'
    This should resolve
    Hope this helps
    Regards
    MuRam

  • JDBC 8.1.6.0.1 Bug with grouping function

    Hi,
    I found a bug in the JDBC 8.1.6.0.1 driver, concerning the new grouping functionality of Oracle 8.1.6. Look at the following code fragment:
    String cSelect = "SELECT DACO_VU_NAME AS DIM1, ' ' AS DIM2, TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm') AS DIM_DATE, GROUPING(DACO_VU_NAME) AS DIM1GROUP, GROUPING(' ') AS DIM2GROUP, GROUPING(TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm')) AS DIM_DATEGROUP, sum(DACO_BRUTTOBETRAG_TX) AS VALUE FROM DATENCONTAINER GROUP BY CUBE (DACO_VU_NAME, '-', TO_CHAR(DACO_VERKAUFSDATUM,'yyyymm') ) ORDER BY 1,2,3";
    try {
    System.out.println("SELECT: " + cSelect);
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(cSelect);
    while (rset.next()) {
    String cTest1 = rset.getString("DIM1");
    String cTest2 = rset.getString("DIM2");
    String cTest3 = rset.getString("DIM_DATE");
    String cChar1 = rset.getString("DIM1GROUP");
    String cChar2 = rset.getString("DIM2GROUP");
    String cChar3 = rset.getString("DIM_DATEGROUP");
    System.out.println(cTest1 + "\t" + cTest2 + "\t" + cTest3 + "\t" + cChar1 + "\t" + cChar2 + "\t" + cChar3);
    }When I compile this with the mentioned JDBC version and run it with java 1.2.2 (JDeveloper 3.1), i get the following output:
    Ahrend GmbH & Co. KG 200003 0 0 0
    Ahrend GmbH & Co. KG 200003 1 0 0
    Ahrend GmbH & Co. KG 200004 0 0 0
    Ahrend GmbH & Co. KG 200004 1 0 0
    Ahrend GmbH & Co. KG null 0 0 1
    Ahrend GmbH & Co. KG null 1 0 1
    null 200003 0 1 0
    null 200003 1 1 0
    null 200004 0 1 0
    null 200004 1 1 0
    null null 0 1 1
    null null 1 1 1As you can see, the grouping columns are mixed up. In this example, everywhere a normal row shows a "null" value, a corresponding grouping row should show a "1", but as you can see, for the last 6 rows, the ones are not in the first, but in the second grouping row.
    When I compile the example with the Oracle 8.1.5 JDBC driver, I get the following, correct, output:
    Ahrend GmbH & Co. KG 200003 0 0 0
    Ahrend GmbH & Co. KG 200004 0 0 0
    Ahrend GmbH & Co. KG null 0 0 1
    Ahrend GmbH & Co. KG 200003 0 1 0
    Ahrend GmbH & Co. KG 200004 0 1 0
    Ahrend GmbH & Co. KG null 0 1 1
    null 200003 1 0 0
    null 200004 1 0 0
    null null 1 0 1
    null 200003 1 1 0
    null 200004 1 1 0
    null null 1 1 1The special thing about this example is, that I use a constant row for grouping (row 2). If you use a normal database row, everything works fine with 8.1.6.0.1, but nevertheless, this should be a bug.
    Any comments on this are highly appreciated, since I need the JDK 1.2 for the application and I didn't find a working Oracle 1.2 JDBC version.
    Thanks,
    Thorsten.

    Patches can be obtained from an Oracle Support Services technical analyst.
    null

  • The bug with JNI function RegisterNatives in Java 1.6

    JDK 1.6 has problems with implementation of native methods in the class that loaded at runtime. I found it after making debug version of JVM.DLL.
    I have JNI code that
    - loads at runtime a new class with native methods;
    - implements these methods with RegisterNatives();
    - gets Field and Constructor IDs (at this time JVM cleans all finction pointers in Methods Table of the class);
    - creates the object of this class and passes it to Java code for callbacks.
    When Java calls my native methods I get the exception: "java.lang.UnsatisfiedLinkError", the naive method was not implemented.
    I did workaround in my JNI code:
    - load the class;
    - get Field and Constructor IDs;
    - implement methods with RegisterNatives();
    - create the object of this class and pass it to Java code for callbacks.
    This version of my code runs fine.

    What I do with Java? I am developing
    - .NET JNI SDK (like regular JNI SDK for C++) for
    integration .NET and SUN/IBM Java codes,
    - technology of integrating Java applications with
    other programming platforms without knowledge of Java
    Application sources,
    - automation of JNI programming in C++ and .NET,
    - tools for conversion AWT based applications to
    SWING, etc.
    Beside Java projects I develop projects with
    Databases, OLAP, WEB in .NET, C++, VB6, etc.
    That is why I have no much time to focus in SUN Java.Yes and I am busy too.
    That had nothing to do with my post however.
    I suggested that if your sole or primary critieria for langauge selection is whether the language forums have company representatives then you should choose .Net rather than java.
    Myself the forum support is never even a minor factor in language selection.

  • Axial shading pattern with different alpha

    Hi,
    I'm trying to apply different alpha values to axial shading pattern when drawing and I've found PDF Axial Shading Pattern ranging opacity very helpful.
    But what kind of soft mask (PDF 1.4) should I use (dictionary or image mask)? And how could I create that mask?
    I wrote some pdf code based on my limited understanding of pdf 1.4 reference and that doesn't work.
    40 0 obj
    <</Type /Group
    /Subtype /Transparency
    /ColorSpace /DeviceGray
    /BitsPerComponent 8>>
    stream
    333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 3333333333333333333333333333333333333333333333333333333333333
    endstream
    endobj
    17 0 obj
    <</Type /Mask
    /Subtype /Alpha
    /G 40 0 R
    >>
    endobj
    18 0 obj
    <</Type /ExtGState
    /SMask 17 0 R
    /ca 1
    >>
    19-26 are FunctionType 2 linear gradient
    26 0 obj
    <</FunctionType 3
    /Domain [0 1]
    /Functions [19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R ]
    /Bounds [0.25 0.25 0.5 0.5 0.75 0.75 ]
    /Encode [0 1 0 1 0 1 0 1 0 1 0 1 0 1 ]
    >>
    endobj
    27 0 obj
    <</Type /Pattern
    /PatternType 2
    /Shading <</ColorSpace /DeviceRGB
    /Function 26 0 R
    /ShadingType 2
    /Coords [37.5 3347.82 187.5 3347.82]
    /Extend [true true]>>
    >>
    /ExtGState <<
    /GS0 18 0 R
    >>

    Thank you for your reply.
    Actually what I'm doing is drawing a rectangle and filling using axial shading pattern (/GS0).
    Before alpha involving, everything works fine. (removing 40, 17 and /SMask 17 0 R in 18)
    PDF Axial Shading Pattern ranging opacity shows we can add a SMask in the ExtGState to achieve the alpha value and I read the PDF 1.4 reference.
    My current stream is based on the generation of soft-mask Image. Is there any sample code showing how to generate the stream?
    My latest try and please correct me if I made some mistakes:
    17 0 obj
    <<
    /Type /Mask
    /Subtype /Alpha
    /G <<
    /Type /XObject
    /S /Transparency
    /CS /DeviceGray
    /Length 150
    >>
    stream
    endstream
    >>
    endobj
    18 0 obj
    <<
    /Type /ExtGState
    /SMask 17 0 R
    /ca 1
    >>
    Thank you and I appreciate your help.

  • Downloaded 11.0.3 (42) 64 bit to my MacBook Pro and it crashes every time I select a song a use the 'add to' function to add to a play list. It's never done this before, is it a bug with the new version?

    downloaded 11.0.3 (42) 64 bit to my MacBook Pro and it crashes every time I select a song a use the 'add to' function to add to a play list. It's never done this before, is it a bug with the new version?

    You could just disable updates. Change these settings in about:config.
    * app.update.auto - set to false
    * app.update.enabled - set to false
    You can still check for updates with the "Check for Updates" button in the About Firefox window, but it will download the update file anyway if there is an update available. You can also check which is the current release from here:
    * http://sjc.mozilla.com/en-US/firefox/new/

  • Bug with function "resume 0x****"  of jdb

    One problem with the function of jdb occured when I tried to use it to
    pilot the processor with differents threads. In fact, I use a simple example with 2 threads.
    I stop the two threads with two breakpoint, and I want to resume one or the other (with the function "resume 0x****"), the one wich I resumed stop again on the breackpoint and I decide again to resume one or the other. All of that to obtain a tree of execution.
    I give you the code of the class and the code of jdb.
    CLASS: (it's just a object Room with a variable degre that I increment and decrement with two threads increase and decrease)
    public class Test{
          public static void main(String[] args){
               Room r = new Room();
               decrease de = new decrease(r);
               increase in = new increase(r);
               de.start();
               in.start();
    class Room {
         private volatile int degre=20;
         public void more(){
            degre += 4;
         public void less(){      
           degre -= 3;     
    class decrease extends Thread{
       private Room room;
       public decrease(Room r){
                 room =r;
       public void run(){
        try{ 
         while (!interrupted()){ 
                    room.less();  
          catch(InterruptedException e) {}
    class increase extends Thread{
       private Room room;
       public increase(Room r){
            room =r;
       public void run(){ 
            try{ 
                 while (!interrupted()){
                      room.more();
           catch(InterruptedException e) {}
    JDB:
    Initializing jdb ...
    stop at Test:7Deferring breakpoint Test:7.
    It will be set after the class is loaded.
    runrun Test
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Test:7
    Breakpoint hit: "thread=main", Test.main(), line=7 bci=30
    7 in.start();
    main[1] stop at room:16
    Set breakpoint room:16
    main[1] stop at room:20
    Set breakpoint room:20
    main[1] resume
    All threads resumed.
    >
    Breakpoint hit: "thread=Thread-0", room.less(), line=20 bci=0
    20 degre -= 3;
    Thread-0[1] threads
    Group system:
    (java.lang.ref.Reference$ReferenceHandler)0x10d Reference Handler cond. waiting
    (java.lang.ref.Finalizer$FinalizerThread)0x10c Finalizer cond. waiting
    (java.lang.Thread)0x10b Signal Dispatcher running
    Group main:
    (decrease)0x146 Thread-0 running (at breakpoint)
    (increase)0x147 Thread-1 running (at breakpoint)
    (java.lang.Thread)0x148 DestroyJavaVM running
    Thread-0[1] resume 0x147
    Thread-0[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] print degre
    degre = 24
    Thread-1[1] resume 0x146 //It's here the problem, thread 0x146 have to stop on the //next breakpoint of decrease but nothing happen
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] clear
    Breakpoints set:
    breakpoint Test:7
    breakpoint room:16
    breakpoint room:20
    PS: I tried many other examples with other class and other kind of breakpoints, but, in any cases, on thread doesn't manage to resume. When I try with general resume (no specification of the thread), It works but it isn't interresting for me because I want to decide wich thread continue his execution.

    Looks like a memory clearing problem in the function. Best to post this problem in an OSS message, or look through the OSS notes to see if the problem has been identified before.
    Michael.

  • 30EA3: German language bug with user defined reports still not fixed

    In 30EA2: Limited folder functionality with German language
    I wrote about a bug in 30EA2. Was this message noticed by the developers?
    The bug still exists in 30EA3.
    In new folders for user definded reports only the options "Kopieren" and "Exportieren" (copy and export) are available, when SQL-Deverloper runs in German language mode.
    A workaround is to force language to English with the line
    AddVMOption -Duser.language=en
    in sqldeveloper.conf

    I made a new thread for the same bug in 3.1EA2:
    3.1EA2 Old bug with German language settings still exists
    I have some hope, that my problem finally got noticed by the developers.

  • Bug in exists() function of XI Graphical Mapping Tool?

    Hi!
    If I connect a source field with the exists() function in XI Graphical Mapping Tool and the tag exists it returns TRUE, otherwise it returns FALSE, so everything works as expected.
    But I have to connect a user-defined function with exists(). The user-defined function will either calculate a value or set Resultset.SUPPRESS.
    If there is a value the exits() function returns TRUE, however if Resultset.SUPPRESS is set it does also return TRUE! This looks to me like a bug in exists() function. Shouldn't it always return FALSE if the input is Resultset.SUPPRESS?
    Regards, Tanja

    Hi Stefan!
    > The exists() function checks, if a queue is empty.
    > An empty queue is <b>not</b> represented by the
    > SUPPRESS value.
    > If inside a queue there is a SUPPRESS value, the
    > queue is <b>not</b> empty.
    Ok, so it's not a bug and the exists() function is working as expected.
    > If you want the exist() function after a UDF, provide
    > an empty queue, or easier: return the values "true"
    > or "false" directly from the UDF.
    Yes, that's how I actually solved the problem. The UDF was used at several places where the ResultList.SUPPRESS output was needed. So I copied the UDF and changed it so that the output was TRUE or FALSE instead.
    Regards, Tanja

  • 3.1EA2 Old bug with German language settings still exists

    In the past I wrote several times about a bug in SQL Developer when running in German language mode. This bug is still not fixed in 3.1 EA2:
    In new folders for user definded reports only the options "Kopieren" and "Speichern unter ..." ('Copy' and 'Cave as') are available, when SQL-Deverloper runs in German language mode. Other options like "Bearbeiten, Neuer Ordner, Neuer Bericht, Ausschneiden, Einfügen, Löschen" (Edit, New Folder, New Report, Cut, Paste, Delete) are missing. A workaround is to force language to English with the line
    AddVMOption -Duser.language=en
    in sqldeveloper.conf
    I mentioned it first in Re: Folders with limited functionality about version 2.1.1.64 and then in 30EA2: Limited folder functionality with German language 3.0 EA2 and German language bug with user defined reports still not fixed Beta Release 3.0 EA3
    Edited by: user1775992 on 22.11.2011 03:30

    I have raised a bug on this issue and I am actively looking into it.

  • Issue with the functions "add matching sets" and "modify matching sets"

    Hi,
    Though 'None' access permission is set for the functions 'Add Matching Sets' and 'Modify Matching Sets', they are accessible.
    Is this a bug with the tool? or am I missing something?
    Thanks in advance,
    Madan

    sorry, missed the version details.
    I'm using MDM 5.5 SP6.

  • ICal bug with month view

    I primarily use week view on iCal, but sometimes i switch to month view for a larger perspective. Often, i use month view to check for any leftover events from the previous month in case i forgot to delete one or two.
    I just found a bug concerning this. If i click on "month" today, it'll take me to the month view for june 2011, and from there i can navigate forwards or backwards. However, may 2011 seems to have a bug. If i click on < from june, it does nothing; if i click again, it takes me to april 2011. Similarly, if i click on > from april it does nothing and if i click again it takes me to june.
    It doesn't end there. The june/may thing happens only when the selected day (the one shaded light grey on the month and week views and bright blue on the little month tab on the left) is after 04 june. If a day from the first week of june (i have my weeks start on sunday) is selected, the < button does take me to may, but several events which i deleted a long time ago are showing up.
    Now, i have an event set for today (04 june). Since the first four days of june are in the same week as the last three of may, the month view for may shows these four days, as any normal calendar app would.
    If i use the month tab to the left to navigate, i can access may 2011 by selecting any day on that month. However, iCal's behaviour depends on which day was selected previously. If the previous day was in april 2011 or earlier, iCal will show the month of may completely empty, which is great because i have no leftover appointments from may; however, the box for 04 june is also empty, which it shouldn't be. If the previous day was in june 2011, it'll show may with a repeating event on every sunday except the first, which is completely absurd, since i have deleted this event (and why isn't it showing on the first sunday in may?); the box for 04 june, however, will correctly show the event i have set for this day. If the previous day was in july 2011 or later, it'll show may with the repeating event on all sundays (including the first one) and it won't show anything on the box for 04 june.
    Obviously, there is a bug with may 2011.
    In case it helps, i do have a repeating event set to all sundays until the end of existence, but i have deleted all the entries from may and previously, since they have obviously already happened. Also, i had many other repeating events set to happen on different weekdays; these are to repeat themselves weekly until about halfway through june, and they started on april or may (can't remember right now). Like the sunday one, i have deleted all the entries from may because they have already taken place. Strangely (and thankfully), none of these appear when i visit may from june or later, as does the sunday event.
    Any help would be greatly appreciated. Or am i forever stuck with week view, which has so far proven to be bug-free?
    (I did a search on Google and another on the Apple forums for this issue but could find nothing, so i decided to ask the question myself. I apologise if somebody has already asked this question and i just couldn't find it.)

    Greetings,
    I have a vague recollection of someone else with this issue but haven't experienced it myself nor encountered it recently.
    Troubleshooting:
    1.) First make an iCal backup: http://support.apple.com/kb/HT2966.
    2.) Remove the following to the trash and restart your computer:
    Home > Library > Caches > com.apple.ical and / or "ical"
    Home > Library > Calendars > Calendar Cache, Cache, Cache 1, 2, 3, etc. (Do not remove Sync Cache or Theme Cache)
    Home > Library > Preferences > com.apple.ical (There may be more than one of these. Remove them all.)
    __NOTE: Removing these files will remove any shared (CalDAV) calendars you may have access to. You will have to re-add those calendars to iCal > Preferences > Accounts.
    Once the computer is back up and running open iCal and test.
    Hope that helps!

  • Optimization bug with C++ inlining

    Hi,
    While evaluating Sun Studio 11 I have identified an optimization bug with C++ inlining.
    The bug can easily be reproduced with the small program below. The program produces
    wrong results with -xO2, because an inline access function always returns the value 0.0
    instead of the value given on the commandline:
    djerba{ru}16 : CC -o polybug  polybug.cc
    djerba{ru}17 : ./polybug 1.0
    coeff(0): 1.000000
    djerba{ru}18 : CC -o polybug -xO2 polybug.cc
    djerba{ru}19 : ./polybug 1.0
    coeff(0): 0.000000            <<<<<<<<<< wrong, should be 1.000000This occurs only with optimization level O2; levels below or above O2 don't
    exhibit the bug.
    Compiler version is
    Sun C++ 5.8 Patch 121017-01 2005/12/11
    on Solaris 8 / Sparc.
    I include a preliminary analysis at the end.
    Best Regards
    Dieter R.
    -------------------- polybug.cc -------------------------
    // note: this may look strange, but this is a heavily stripped down
    // version of actual working application code...
    #include <stdio.h>
    #include <stdlib.h>
    class Poly {
      public:
        // constructor initializes number of valid coefficients to zero:
        Poly() { numvalid = 0; };
        ~Poly() {};
        // returns coefficient with index j, if valid. Otherwise returns 0.0:
        double coeff(int j) {
         if (j < numvalid) {
             return coefficients[j];
         } else {
             return 0.0;
       // copies contents of this Object to other Poly:
        void getPoly(Poly& q) { q = *this; };
        // data members:
        // valid coefficients: 0 ... (numvalid - 1)
        double coefficients[6];
        int numvalid;
    void troublefunc(Poly* pC) {
        // copies Poly-Object to local Poly, extracts coefficient
        // with index 0 and prints it. Should be the value given
        // on commandline.
        // Poly constructor, getPoly and coeff are all inline!
        if (pC) {
         Poly pol;                      
         pC->getPoly(pol);
         printf("coeff(0): %f\n",pol.coeff(0));
    int main(int argc,char* argv[]) {
        double d = atof(argv[1]);
        // creates Poly object and fills coefficient with index
        // 0 with the value given on commandline
        Poly* pC = new Poly;
        pC->coefficients[0] = d;
        pC->numvalid = 1;
        troublefunc(pC);   
        return 0;
    The disassembly fragment below shows that the access function coeff(0), instead
    of retrieving coefficient[0] simply returns the fixed value 0.0 (presumably because the
    optimizer "thinks" numvalid holds still the value 0 from the constructor and that therefore
    the comparison "if (i < numvalid)" can be omitted).
    Note: disassembly created from code compiled with -features=no%except for simplicity!
    00010e68 <___const_seg_900000102>:
            ...     holds the value 0.0
    00010e80 <__1cLtroublefunc6FpnEPoly__v_>:
       10e80:       90 90 00 08     orcc  %g0, %o0, %o0      if (pC) {   
       10e84:       02 40 00 14     be,pn   %icc, 10ed4
       10e88:       9c 03 bf 50     add  %sp, -176, %sp
                                                       local Poly object at %sp + 120
                                                             numvalid at %sp + 0xa8 (168)
       10e8c:       c0 23 a0 a8     clr  [ %sp + 0xa8 ]      Poly() { numvalid = 0; };
                                                             pC->getPoly(pol):
                                                             loop copies *pC to local Poly object
       10e90:       9a 03 a0 80     add  %sp, 0x80, %o5
       10e94:       96 10 20 30     mov  0x30, %o3
       10e98:       d8 5a 00 0b     ldx  [ %o0 + %o3 ], %o4
       10e9c:       96 a2 e0 08     subcc  %o3, 8, %o3
       10ea0:       16 4f ff fe     bge  %icc, 10e98
       10ea4:       d8 73 40 0b     stx  %o4, [ %o5 + %o3 ]
                                                             pol.coeff(0):
                                                             load double value 0.0 at
                                                             ___const_seg_900000102 in %f0
                                                             (and address of format string in %o0)
       10ea8:       1b 00 00 43     sethi  %hi(0x10c00), %o5
       10eac:       15 00 00 44     sethi  %hi(0x11000), %o2
       10eb0:       c1 1b 62 68     ldd  [ %o5 + 0x268 ], %f0
       10eb4:       90 02 a0 ac     add  %o2, 0xac, %o0
       10eb8:       82 10 00 0f     mov  %o7, %g1
                                                             store 0.0 in %f0 to stack and load it
                                                             from there to %o1/%o2
       10ebc:       c1 3b a0 60     std  %f0, [ %sp + 0x60 ]
       10ec0:       d2 03 a0 60     ld  [ %sp + 0x60 ], %o1
       10ec4:       d4 03 a0 64     ld  [ %sp + 0x64 ], %o2
       10ec8:       9c 03 a0 b0     add  %sp, 0xb0, %sp
                                                             call printf
       10ecc:       40 00 40 92     call  21114 <_PROCEDURE_LINKAGE_TABLE_+0x54>
       10ed0:       9e 10 00 01     mov  %g1, %o7
       10ed4:       81 c3 e0 08     retl
       10ed8:       9c 03 a0 b0     add  %sp, 0xb0, %sp
    Hmmm... This seems to stress this formatting tags thing to its limits...

    Thanks for confirming this.
    No, this happens neither in an Open Source package nor in an important product. This is an internal product, which is continuously developed with Sun Tools since 1992 (with incidents like this one being very rare).
    I am a bit concerned with this bug though, because it might indicate a weakness in the area of C++ inlining (after all, the compiler fails to correctly aggregate a sequence of three fairly simple inline functions, something which is quite common in our application). If, on the other hand, this is a singular failure caused by unique circumstances which we have hit by sheer (un)luck, it is always possible to work around this: explicitly defining a assignment operator instead of relying on the compiler-generated one is sufficient to make the bug go away.

  • [svn:fx-trunk] 11250: Fixing proxy pattern bug in VideoPlayer.

    Revision: 11250
    Author:   [email protected]
    Date:     2009-10-28 17:07:19 -0700 (Wed, 28 Oct 2009)
    Log Message:
    Fixing proxy pattern bug in VideoPlayer.  I tried to save a few extra bytes by not keeping around an extra object, but I made a mistake with this code.  It seems better just to follow the typical pattern and not worry about this extra savings, which probably cost more in code-size anyways. 
    Also changing VideoPlayer.thumbnailSource to mx_internal, rather than public.  In VideoElement it's mx_internal, and that's what it should be here too.
    QE notes: -
    Doc notes: -
    Bugs: SDK-23665
    Reviewer: Deepa
    Tests run: checkintests, mustella VideoPlayer
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23665
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer.as

  • Workshop 6 Bug with STLport hash_map operator []

    Using hash_map<string, string>:operator[] in a debug build crashes; in release, it doesn't. This must be a compiler bug, yes? Here's how to reproduce it.
    <PRE>
    [valhalla:~/test] $ cat t.c
    #include <string>
    #include <hash_map>
    using namespace std;
    main()
    hash_map<string, string> m;
    m["stl"] = "port";
    string s = m["stl"];
    [valhalla:~/test] $ rm -rf SunWS_cache/
    [valhalla:~/test] $ CC -I/apps/stlport-4.5.3/stlport -L/apps/stlport-4.5.3/lib -R/apps/stlport-4.5.3/lib -lstlport_sunpro t.c
    [valhalla:~/test] $ a.out
    [valhalla:~/test] $ rm -rf SunWS_cache/
    [valhalla:~/test] $ CC -g -I/apps/stlport-4.5.3/stlport -L/apps/stlport-4.5.3/lib -R/apps/stlport-4.5.3/lib -lstlport_sunpro t.c
    [valhalla:~/test] $ a.out
    Bus Error (core dumped)
    [valhalla:~/test] $ dbx -q a.out core
    core file header read successfully
    program terminated by signal BUS (invalid address alignment)
    Current function is STL::_stl_delete
    99 inline void STLPCALL __stl_delete(void* __p) { ::operator delete(__p); }
    (dbx) where
    [1] freeunlocked(0xffbee657, 0xff23a000, 0xffbee657, 0xff23a000, 0x237e8, 0xff1c291c), at 0xff1c2974
    [2] free(0xffbee657, 0xffbee5d4, 0xffbee658, 0xffbee5e2, 0xffbee5e1, 0xff19bb88), at 0xff1c2924
    [3] operator delete(0xffbee657, 0xffbee658, 0xffbee657, 0xff37e540, 0x13bb0, 0x1ee00), at 0xff3636f8
    =>[4] STL::_stl_delete(__p = 0xffbee657), line 99 in "new"
    [5] STL::_node_alloc<true,0>::deallocate(__p = 0xffbee657, __n = 4347225U), line 253 in "_alloc.h"
    [6] STL::allocator<char>::deallocate(this = 0xffbee5b0, _p = 0xffbee657 "", __n = 4347225U), line 360 in "_alloc.h"
    [7] STL::STLP_alloc_proxy<char*,char,_STL::allocator<char> >::deallocate(this = 0xffbee5b0, __p = 0xffbee657 "", __n = 4347225U), line 506 in "_alloc.h"
    [8] STL::String_base<char,_STL::allocator<char> >::_M_deallocate_block(this = 0xffbee5a8), line 124 in "_string.h"
    [9] STL::String_base<char,_STL::allocator<char> >::~_String_base(this = 0xffbee5a8), line 135 in "_string.h"
    [10] STL::basicstring<char,_STL::char_traits<char>,_STL::allocator<char> >::~basic_string(this = 0xffbee5a8), line 302 in "_string.h"
    [11] STL::hashmap<_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> >,_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> >,_STL::hash<_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > >,_STL::equal_to<_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > >,_STL::allocator<_STL::pair<const STL::basicstring<char,_STL::char_traits<char>,_STL::allocator<char> >,_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > > > >::operator[](this = 0xffbee680, __key = CLASS), line 186 in "_hash_map.h"
    [12] main(), line 8 in "t.c"
    (dbx) exit
    [valhalla:~/test] $ exit
    exit
    [valhalla:~/test] $ which CC
    /apps/SUNWspro64/bin/CC
    [valhalla:~/test] $ CC -V
    CC: Sun WorkShop 6 update 1 C++ 5.2 Patch 109508-09 2002/07/08
    [valhalla:~/test] $ uname -a
    SunOS valhalla 5.8 Generic_108528-15 sun4u sparc SUNW,Sun-Blade-100
    </PRE>
    STLport places all of its classes in its own _STL namespace, so there is no concern for name collision with std types that come with the Sun compiler. 
    Any ideas?
    Regards,
    Jason

    I found out this is compiler bug with Forte 6 that ocurrs when inlining is enabled and temporaries are used in conditional expressions with the ?: operator, e.g.,
    [valhalla:~/test] $ cat tt.c
    #include <iostream>
    #include <stdlib.h>
    using namespace std;
    struct X {
    X() { cout << "X ctor" << endl; }
    ~X() { cout << "X dtor" << endl; }
    int foo() { return 1; }
    struct Y {
    Y() { cout << "Y ctor" << endl; }
    ~Y() { cout << "Y dtor" << endl; }
    int foo() { return 1; }
    inline int foo(int i)
    return i ?
    X().foo() :
    Y().foo() ;
    main(int, char **argv)
    return foo(atoi(argv[1]));
    [valhalla:~/test] $ rm -rf SunWS_cache/
    [valhalla:~/test] $ CC -g tt.c
    [valhalla:~/test] $ a.out 1
    X ctor
    X dtor
    [valhalla:~/test] $ rm -rf SunWS_cache/
    [valhalla:~/test] $ CC tt.c
    [valhalla:~/test] $ a.out 1
    X ctor
    Y dtor
    X dtor
    [valhalla:~/test] $ g++ tt.c
    [valhalla:~/test] $ a.out 1
    X ctor
    X dtor

Maybe you are looking for

  • Change Parition Size in Leopard?

    I've heard Leopard has the ability to create and change the size of partitions on the fly. Does this also apply to your Boot Camp partition? And if not, how would I go about taking my Boot Camp partition, creating a new Parallels-only partition and r

  • Order booking on one customer and invoicing a different customer

    Hi all, I have a requirement wherein I book a sales order on one customer C1. And I need to ship the goods to some C2, who is a customer for C1. I should invoice C2 and not C1. I get the payment from C2. how can I achieve this? plz help. Thanks in ad

  • Report Output in a single page,

    I have a report which is registered in apps, the ouput is around 20 pages, now my question is, is there any options to get the ouput in a single page with out any pagebreaks. help needed urgent thanks in advance

  • IPhone - PDF Page Display Problem

    I am trying to display pages from a PDF included in my application to a Quartz context. I can get the first page to display correctly, but am having trouble displaying subsequent pages. In essence I am using the example shown in the Quartz 2D program

  • Installing Flash player in Vista 64

    I could not get player 10 to install in Vista 64 despite repeated attempts. It would fail to load a .dll to a specific directory. After repeated attempts, I realized the directory was never created by the installer. So, here's the deal: go to C:/Wind