The idea that everything a Pope (or the Catholic church) teaches is infallible is simply a flawed premise.
After searching on the Vatican website, I found that the CCC quite clearly defines dogma, which is the form of doctrine which is infallible or irrevocable in the words of the CCC (emphasis mine):
The dogmas of the faith
88 The Church's Magisterium exercises the authority it holds from Christ to the fullest extent when it defines dogmas, that is, when it proposes, in a form obliging the Christian people to an irrevocable adherence of faith, truths contained in divine Revelation or also when it proposes, in a definitive way, truths having a necessary connection with these.
89 There is an organic connection between our spiritual life and the dogmas. Dogmas are lights along the path of faith; they illuminate it and make it secure. Conversely, if our life is upright, our intellect and heart will be open to welcome the light shed by the dogmas of faith.
90 The mutual connections between dogmas, and their coherence, can be found in the whole of the Revelation of the mystery of Christ. "In Catholic doctrine there exists an order or hierarchy of truths, since they vary in their relation to the foundation of the Christian faith."
But the Catholic teaching on and use of ex cathera dogmatic declarations is difficult to unravel. In the history of the Catholic Church I can find authoritative references (wikipedia is not authoritative) for only three doctrines which are undisputed to have been declared ex cathedra dogma:
- The Immaculate Conception of Mary (declared by Pope Pius IX in 1854, CCC 491 & 966)
- The Bodily Assumption of Mary into Heaven (declared by Pope Pius XII in 1950, CCC 966)
- The Holy Trinity (CCC 249 - 256)
That appears to be it. Searching the Vatican website we can turn up other references to possibilities:
- Dogma of Papal Infallibility (referenced by many papers on the Vatican.va site)
- Dogma of original sin (but specifically mentioned as disputed)
- Dogma of the Consubstantiality (proposed by Pius XI, uncertain if ratified by the bishops)
Though I can't find a reference, I would expect that all creedal statements of church councils which are recognized as valid by the Catholic church are considered dogmatic.
To further muddy the water, many church doctrines are widely considered dogmatic while never having been officially declared as such; these are popularly treated as dogmatic and have an extremely low possibility of ever being rescinded (and the creeds may be in this category).
The main point is that truly ex cathedra dogmatic and irrevocable doctrines are few and far between.
All other doctrinal positions are subject to modification and may be rescinded, even the "ordinary" conclusions and declarations of church councils. That is not to say they are to be taken lightly; papal and official statements from the church are to be considered binding on all Catholics for as long as they are in force -- but they are not automatically infallible.
See this CSE answer and this article from uscatholic.org and this Vatican statement on infallibility for more details. The last of these explicitly mentions the only two undisputed ex cathedra statements made:
As you know there are cases in which the papal Magisterium is exercised solemnly regarding particular points of doctrine belonging to the deposit of revelation or closely connected with it. This is the case with ex cathedra definitions, such as those of Mary's Immaculate Conception, made by Pius IX in 1854, and of her Assumption into heaven, made by Pius XII in 1950. As we know, these definitions have provided all Catholics with certainty in affirming these truths and in excluding all doubt in the matter.
Specifically note the words: "... there are cases in which ...".
From what I have been able to ascertain, it seems like quite specific verbiage introduces an ex cathedra declaration, along the lines of:
... by the authority of Jesus Christ our Lord, of the Blessed Apostles Peter and Paul, and by our own: We declare, pronounce, and define that ...